blob: 219c652a13d76903bf445b27c7489c7c0404c822 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use wasm_bindgen::prelude::*;
use log::*;
use crate::*;
#[wasm_bindgen]
pub fn start_graphics(canvas: web_sys::OffscreenCanvas) {
logger::init_logger();
info!("graphics: wasm entry-point reached");
//debug!("js value is?: undefined: {}", canvas.is_undefined());
match context::graphics::GraphicsContext::from_canvas(canvas) {
Ok(ctx) => context::set_graphics(ctx),
Err(e) => {
error!("graphics {}", e);
panic!()
}
}
}
#[wasm_bindgen]
pub fn loop_graphics() {
context::get_graphics().update()
.map_err(|e| error!("gaphics loop {}", e))
.unwrap();
}
|