rust/lib-hedgewars-engine/src/instance.rs
changeset 14314 b8871dd33ec4
parent 14293 3152d9fdb499
child 14315 21be7838a127
--- a/rust/lib-hedgewars-engine/src/instance.rs	Sun Nov 25 00:23:32 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/instance.rs	Sun Nov 25 05:52:06 2018 +0300
@@ -3,12 +3,29 @@
     UnorderedEngineMessage::*, UnsyncedEngineMessage::*, *
 };
 
+use gfx::{
+    format::{R8_G8_B8_A8, D24, Unorm}
+};
+use gfx_device_gl as gfx_gl;
+use self::gfx_gl::{
+    Resources,
+    CommandBuffer
+};
+
 use super::{ipc::IPC, world::World};
 
-#[repr(C)]
+pub struct EngineGlContext {
+    pub device: gfx_gl::Device,
+    pub factory: gfx_gl::Factory,
+    pub render_target: gfx::handle::RenderTargetView<Resources, (R8_G8_B8_A8, Unorm)>,
+    pub depth_buffer: gfx::handle::DepthStencilView<Resources, (D24, Unorm)>,
+    pub command_buffer: gfx::Encoder<Resources, CommandBuffer>
+}
+
 pub struct EngineInstance {
     pub world: World,
     pub ipc: IPC,
+    pub gl_context: Option<EngineGlContext>
 }
 
 impl EngineInstance {
@@ -17,18 +34,19 @@
         Self {
             world,
             ipc: IPC::new(),
+            gl_context: None
         }
     }
 
     pub fn render<R, C>(
         &self,
-        context: &mut gfx::Encoder<R, C>,
-        target: &gfx::handle::RenderTargetView<R, gfx::format::Rgba8>,
+        command_buffer: &mut gfx::Encoder<R, C>,
+        render_target: &gfx::handle::RenderTargetView<R, gfx::format::Rgba8>,
     ) where
         R: gfx::Resources,
         C: gfx::CommandBuffer<R>,
     {
-        context.clear(target, [0.0, 0.5, 0.0, 1.0]);
+        command_buffer.clear(render_target, [0.0, 0.5, 0.0, 1.0]);
     }
 
     fn process_unordered_message(&mut self, message: &UnorderedEngineMessage) {