lf-gfx 0.9.0

A collection of utilities that we use.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use wasm_bindgen::JsCast;

pub(crate) fn get_canvas() -> web_sys::HtmlCanvasElement {
    let window = web_sys::window().unwrap();
    let document = window.document().unwrap();
    document
        .get_element_by_id("game")
        .expect("you must include a canvas with ID `game` to render into: `<canvas id=\"game\"/>`")
        .dyn_into::<web_sys::HtmlCanvasElement>()
        .unwrap()
}