* WIP on wasm support
Fix canvas not showing by actually placing it in the document
Also set the initial title
Use the js! macro to draw pixels
Draw to the canvas using ImageData
It doesn't work because an animation frame needs to be requested somehow
* Complete WASM work into a usable state.
This works on the previous commits and makes it usable.
There is a multi platform example about how to use it here:
https://github.com/dc740/minifb-async-examples
Co-authored-by: Thomas Versteeg <thomasversteeg@gmx.com>
On Windows when moving the cursor out of the window while holding a
mouse button down it would still be set to
true when entering the window
even if the button had been released
outside of the window.
Closes#280
wlroots based compositors reuse the same FD for keymap, so after a first
read is done, the file is seeked to the end and the next read fails,
causing the following error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }'
The Wayland documentation says the FD "can be memory-mapped to provide
a keyboard mapping description" and then "From version 7 onwards, the
fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may
fail."
Although it is not very clear, it probably means that the FD must be
memory-mapped.
* + Add getter for window position (macos, windows).
+ Add getter STUB for window position (posix x11/wayland).
* Implement getter for window position (posix x11).
* Remove todo from getter for window position and return 0,0 (posix wayland).
* Add set_icon() for Windows
* Start x11 icon method
* Add set_icon() for X11
* Add unimplemented message
* Add Icon class for abstraction
* Adjust example in docs
* Remove CStrings from X11 because of heap allocations
* Fix rustfmt
* Revert accidental changes to image.rs
* Fix doc error
Add a callback for key events. This includes all events such as
Shift, not just text events.
An empty default handler is provided for backwards compatibility.
Signed-off-by: Sean Cross <sean@xobs.io>
* key_handler: add a callback for key events
Add a callback for key events. This includes complete events such as
Shift, not just text events.
A default handler is provided for backwards compatibility.
Signed-off-by: Sean Cross <sean@xobs.io>
* fix: EventQueue::dispatch blocks until some events are available (#265)
use non blocking alternative as documented in EventQueue
Co-authored-by: vemoo <berublan@gmail.com>
* Added not-yet-working draft implementation of proper X11 support for reading correct typed characters
* Made shift work for capital letters with X11, but compose key is still broken
* Compose key and numpad now work correctly in X11
* XIM and XIC are now freed when a window destructor runs
* Ran cargo fmt on x11.rs
* Removed commented-out empty-string
Closes#200
* KeyHandler: Updated return type to Vec on get_keys
* Window: Updated Window structs get_keys return type across all currently supported OS's
* Updated return type of get_keys of Window, and updated the docs for all related functions
* Docs: Corrected incorrect variable ident in docs post update
* Resolved error resulting from get_keys return type change
* Formatting: Ran cargo fmt
Co-authored-by: Zij-IT <elijah.reed@hartvigsen.xyz>
The `SelectObject()` call accepts a `HGDIOBJ` which is typecast to a
`std::os::raw::c_void` when building using libstd, and is its own thing
when building with std disabled:
winapi/0.3.9/src/winapi/lib.rs.html:
#[cfg(feature = "std")]
pub use std::os::raw::c_void;
#[cfg(not(feature = "std"))]
pub enum c_void {}
This patch uses `HGDIOBJ` as the typecast as necessary.
Signed-off-by: Sean Cross <sean@xobs.io>
The xkbcommon_sys crate seems to have been updated today, and now the minifb project won't compile.
We can fix this by updating XKB_KEYMAP_FORMAT_TEXT_v1 to XKB_KEYMAP_FORMAT_TEXT_V1.
* WindowOptions: add none flag
* windows: support none flag
Signed-off-by: rupansh <rupanshsekar@hotmail.com>
* os: implement none flags for other operating systems
redox, posix
not applicable on OSX
* WindowOptions: document none option
Signed-off-by: rupansh-arch <rupanshsekar@hotmail.com>