aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/lib.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:19 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:19 +0100
commit95cc5ed06b4e251fd560958fe6f53d11d3bf31cd (patch)
tree29e28be74667d4fc526fe85558e5311212ffaff6 /stockton-render/src/lib.rs
parent6770b306fc0b14a96b29281f9b46ea3e912d339b (diff)
[wip] feat(render): add draw_triangle function
currently broken
Diffstat (limited to 'stockton-render/src/lib.rs')
-rw-r--r--stockton-render/src/lib.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/stockton-render/src/lib.rs b/stockton-render/src/lib.rs
index 79de1ce..f0a88ee 100644
--- a/stockton-render/src/lib.rs
+++ b/stockton-render/src/lib.rs
@@ -37,6 +37,7 @@ extern crate gfx_backend_vulkan as back;
extern crate gfx_hal as hal;
extern crate stockton_types;
+extern crate shaderc;
extern crate winit;
extern crate arrayvec;
@@ -45,9 +46,9 @@ mod error;
mod draw;
use error::{CreationError, FrameError};
-use draw::RenderingContext;
+use draw::{RenderingContext, Tri2};
-use stockton_types::World;
+use stockton_types::{World, Vector2};
use winit::Window;
@@ -70,8 +71,13 @@ impl<'a> Renderer<'a> {
})
}
- /// Draw a frame of solid `color` (RGBA)
- pub fn draw_clear(&mut self, color: [f32; 4]) -> Result<(), FrameError> {
- self.context.draw_clear(color)
+ /// Render a single frame of the world
+ pub fn render_frame(&mut self) -> Result<(), FrameError>{
+ // self.context.draw_clear([0.0, 0.5, 0.5, 1.0])
+ self.context.draw_triangle(Tri2 ([
+ Vector2::new(-0.5, -0.5),
+ Vector2::new(0.5, -0.5),
+ Vector2::new(0.0, 0.5)
+ ]))
}
}