rendering works in pure ECS. This is actually pretty sweet. broke compu rendering though

This commit is contained in:
2020-09-17 23:55:21 -07:00
parent 76c75c349b
commit 34b5d7b3d0
11 changed files with 429 additions and 213 deletions

View File

@@ -9,7 +9,7 @@ use std::any::Any;
use crate::{VertexTypeContainer};
use winit::event::Event;
use crate::util::tr_event::{TrEvent, TrUIEvent};
use crate::drawables::sprite::{Velocity, Geometry};
use crate::render_system::Position;
enum CustomEvent {
@@ -27,14 +27,6 @@ pub trait Drawable {
depth: f32,
) -> Vec<VertexTypeContainer>;
// Update simply passes the delta time. The implementor doesn't necessarily need to use delta_time
// or even add anything other than a Vec::new() to the function.
fn update<T>(&self, delta_time: f32) -> Vec<TrUIEvent<T>>;
// Notify is where custom events created in other parts of the system will be ingested. It
// might be a good idea in the future to have some of pre-function-call filtering so we
// don't have as many notifies that just immediately reject.
fn notify<Y: 'static, T: 'static>(&self, tr_event : Vec<TrEvent<Y>>, ui_events: Vec<TrUIEvent<T>>) -> Vec<TrUIEvent<T>>;
}
@@ -60,18 +52,18 @@ impl CanvasFrame {
}
}
/// Push this drawable onto the back of the accumulator
pub fn draw(&mut self, drawable: &dyn Drawable, mv: Velocity, geom: Geometry) {
for i in drawable.render(
self.window_size,
(mv.pos_x, mv.pos_y),
geom.rotation,
(geom.size_x, geom.size_y),
geom.depth
) {
self.map.push(i);
}
}
// /// Push this drawable onto the back of the accumulator
// pub fn draw(&mut self, drawable: &dyn Drawable, pos: Position, geom: Geometry) {
// for i in drawable.render(
// self.window_size,
// (mv.pos_x, mv.pos_y),
// geom.rotation,
// (geom.size_x, geom.size_y),
// geom.depth
// ) {
// self.map.push(i);
// }
// }
}