Expand description

web-sys-main-loop provides a main loop (or game loop), and input handling, for a web_sys window.

Example:

use web_sys_main_loop::FrameState;

let window = web_sys::window().unwrap();

web_sys_main_loop::start(&window, move |frame_state: FrameState| {
    ...
    // Gets the position (X, Y) of the cursor in the window
    // context
    let curr_position = frame_state.mouse_state.get_position();
    ...
});

Structs

  • Contains the input state for the current frame.
  • Contains the state of the mouse in the current frame

Enums

  • The possible buttons that can be pressed on a mouse.

Functions