summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/graphics.rs
blob: 690b4cdf7ee8d2b9f9ae2b7d4f44e6a6957629ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)
    }
}

#[wasm_bindgen]
pub fn loop_graphics() {
    debug!("graphics: loopin'");
}