summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/context/mod.rs
blob: 3e8261be400499e94984909b88518bb8e6b3ddbf (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
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) }
}