Skip to content

web-sys-main-loop provides a main loop (or game loop) for a web-sys window, with input handling built-in

License

Notifications You must be signed in to change notification settings

arongeo/web-sys-main-loop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crates.io Version Crates.io License docs.rs

web-sys-main-loop

web-sys-main-loop as per the name suggests provides a main loop (in game development communities often called a game loop), for web-sys based WASM pages, with also providing input handling.

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();
    ...
});

About

web-sys-main-loop provides a main loop (or game loop) for a web-sys window, with input handling built-in

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages