Add event handling to systems

This commit is contained in:
Emre Osmanoğlu 2025-09-10 15:54:23 +03:00
parent c32a452f17
commit 948a929040
5 changed files with 30 additions and 23 deletions

View file

@ -66,6 +66,9 @@ impl<E: EngineTrait> Platform<E> for GliumPlatform<E> {
.systems
.values_mut()
.for_each(|system| system.handle_event(&mut self.window, event.clone()));
let mut ctx2 = ctx.clone();
ctx2.current_event = event.clone();
self.engine.handle_event(ctx2.clone());
match event {
Event::WindowEvent { event, .. } => match event {
@ -94,8 +97,6 @@ impl<E: EngineTrait> Platform<E> for GliumPlatform<E> {
_ => {},
},
Event::AboutToWait => {
let mut ctx2 = ctx.clone();
ctx2.current_event = event.clone();
self.engine.update(ctx2);
self.rendering_system_manager
.systems