summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/context/mod.rs
blob: 09902ce9400a37063be7852e038351cd1544e741 (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
26
mod shader;
mod webgl;
pub mod graphics;
pub mod logic;

use graphics::GraphicsContext;
use logic::LogicContext;

static mut GTX: Option<GraphicsContext> = None;
static mut LTX: Option<LogicContext> = None;

pub fn get_graphics() -> &'static mut GraphicsContext {
    unsafe { GTX.as_mut().unwrap() }
}

pub fn get_logic() -> &'static mut LogicContext {
    unsafe { LTX.as_mut().unwrap() }
}

pub fn set_graphics(gtx: GraphicsContext) {
    unsafe { GTX = Some(gtx) }
}

pub fn set_logic(ltx: LogicContext) {
    unsafe { LTX = Some(ltx) }
}