winit icon indicating copy to clipboard operation
winit copied to clipboard

Make "fill" module used by examples more useful + add an input tester example

Open wareya opened this issue 7 months ago • 2 comments

  • [ ] Tested on all platforms changed
  • [ ] Added an entry to the changelog module if knowledge of this change could be valuable to users
  • [ ] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • [X] Created or updated an example program if it would help users understand this functionality

Dev-only change.

Adds a fill_window_with_fn function to the fill module (only used by examples, not winit's outward-facing API), which allows examples to graphically display real information instead of just a blank screen. However, softbuffer, used internally by the fill module, is very slow on certain platforms (web, mac os), so the usage of this new function should be limited to basic test-that-this-thing-works examples, and not used for "game" or "application" style examples. Also adds a dev dependency on font8x8 so that examples can easily display text.

Also adds an input tester example that uses the new function. The input tester is a low-complexity scribbling/drawing application. The tester is force-aware for Touch events when Touch force is supported.

The html file for the web version of the example has a fixed canvas size because of what seems to be a bug inside of softbuffer where it crashes on web if the width of the canvas is a weird value.

I tested the input tester tested on windows and web.

https://github.com/user-attachments/assets/d90d4ddd-be4d-4579-99d0-7c65f9e9fe73

Screenshot_20250508-170923

This was inspired by a tablet tester I made for locally testing whether my tablet support fork worked (not part of this PR)

https://github.com/user-attachments/assets/f07d59ea-959f-457e-91a5-58540a445c8a

wareya avatar May 08 '25 21:05 wareya

Huh, cargo-deny is failing onzerocopy 🤔 That's so weird...

wareya avatar May 08 '25 21:05 wareya

ahash updated and now as of 0.8.12 depends on a newer version of zerocopy which is where the cargo deny error comes from.

wareya avatar May 08 '25 23:05 wareya