diff options
author | HampusM <hampus@hampusmat.com> | 2024-12-09 14:09:49 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-12-09 14:09:49 +0100 |
commit | 936c801305dfb053dd3e67687f61b7201d9e1064 (patch) | |
tree | b52b404447e8a4415d7e34558a6036ae3eca5d35 /engine/src/window.rs | |
parent | dcc40c9205e5f4cf484523f97eb12a561d7b2b22 (diff) |
chore(engine): use ecs lib phases
Diffstat (limited to 'engine/src/window.rs')
-rw-r--r-- | engine/src/window.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/engine/src/window.rs b/engine/src/window.rs index 008c09b..00c360e 100644 --- a/engine/src/window.rs +++ b/engine/src/window.rs @@ -4,16 +4,22 @@ use std::ffi::{CStr, CString}; use bitflags::bitflags; use ecs::actions::Actions; use ecs::extension::Collector as ExtensionCollector; +use ecs::phase::{Phase, PRESENT as PRESENT_PHASE, START as START_PHASE}; +use ecs::relationship::{ChildOf, Relationship}; use ecs::sole::Single; -use ecs::Sole; +use ecs::{static_entity, Sole}; use glfw::window::{Hint as WindowCreationHint, HintValue as WindowCreationHintValue}; use glfw::WindowSize; use util_macros::VariantArr; use crate::data_types::dimens::Dimens; -use crate::event::{Conclude as ConcludeEvent, Start as StartEvent}; use crate::vector::Vec2; +static_entity!( + pub UPDATE_PHASE, + (Phase, <Relationship<ChildOf, Phase>>::new(*PRESENT_PHASE)) +); + #[derive(Debug, Sole)] /// Has to be dropped last since it holds the OpenGL context. #[sole(drop_last)] @@ -685,8 +691,8 @@ impl ecs::extension::Extension for Extension { fn collect(self, mut collector: ExtensionCollector<'_>) { - collector.add_system(StartEvent, initialize); - collector.add_system(ConcludeEvent, update); + collector.add_system(*START_PHASE, initialize); + collector.add_system(*UPDATE_PHASE, update); let window = self .window_builder |