summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/context/mod.rs
diff options
context:
space:
mode:
authornatrixaeria <janng@gmx.de>2019-06-13 00:38:21 +0200
committernatrixaeria <janng@gmx.de>2019-06-13 00:38:21 +0200
commitc3fdf122bd874bd0aedf90eff0d57cc440fc6421 (patch)
tree0220c9961cd37a58d4398741aec32e6619379bbc /webhogg/wasm/src/context/mod.rs
parent1b6a2835e57a7d399f43ecf493060e68042f9af8 (diff)
Split code into graphics and logic loop
Diffstat (limited to 'webhogg/wasm/src/context/mod.rs')
-rw-r--r--webhogg/wasm/src/context/mod.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/webhogg/wasm/src/context/mod.rs b/webhogg/wasm/src/context/mod.rs
new file mode 100644
index 0000000..3e8261b
--- /dev/null
+++ b/webhogg/wasm/src/context/mod.rs
@@ -0,0 +1,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) }
+}