rust/lib-hedgewars-engine/src/lib.rs
changeset 14193 3b83ec44e10b
parent 14174 e2c51c8e0b2e
child 14210 a8fe9cd51154
--- a/rust/lib-hedgewars-engine/src/lib.rs	Fri Nov 09 20:15:29 2018 +0300
+++ b/rust/lib-hedgewars-engine/src/lib.rs	Fri Nov 09 23:03:45 2018 +0300
@@ -2,6 +2,8 @@
 extern crate land2d;
 extern crate landgen;
 extern crate lfprng;
+extern crate gfx;
+extern crate gfx_device_gl;
 
 mod world;
 mod engine_message;
@@ -12,6 +14,23 @@
     world: world::World,
 }
 
+impl EngineInstance {
+    pub fn new() -> Self {
+        let world = world::World::new();
+        Self { world }
+    }
+
+    pub fn render<R, C>(
+        &self,
+        context: &mut gfx::Encoder<R, C>,
+        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]);
+    }
+}
+
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct PreviewInfo {