summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/context/mod.rs
diff options
context:
space:
mode:
authorDennis Kobert <d-kobert@web.de>2019-06-21 23:52:07 +0200
committerDennis Kobert <d-kobert@web.de>2019-06-21 23:52:07 +0200
commit4e0037169db5d0c7d824debedb5513b69676506a (patch)
tree82c56547fa70b499627236efa66c3bf7e5411ead /webhogg/wasm/src/context/mod.rs
parent36c89240a87ecb826cf09bc7b3069aa636c9f2f1 (diff)
parent031f63755aada2f1b51eb945fda2a18ad0d24aad (diff)
Merge branch 'wasm' into game_server_refactor
Diffstat (limited to 'webhogg/wasm/src/context/mod.rs')
-rw-r--r--webhogg/wasm/src/context/mod.rs26
1 files changed, 26 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..09902ce
--- /dev/null
+++ b/webhogg/wasm/src/context/mod.rs
@@ -0,0 +1,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) }
+}