summaryrefslogtreecommitdiff
path: root/engine/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/lib.rs')
-rw-r--r--engine/src/lib.rs45
1 files changed, 8 insertions, 37 deletions
diff --git a/engine/src/lib.rs b/engine/src/lib.rs
index b1c41d6..01c0701 100644
--- a/engine/src/lib.rs
+++ b/engine/src/lib.rs
@@ -3,15 +3,12 @@
use crate::asset::{Assets, Extension as AssetExtension};
use crate::delta_time::{update as update_delta_time, DeltaTime, LastUpdate};
-use crate::ecs::component::Sequence as ComponentSequence;
+use crate::ecs::error::HandlerFn as ErrorHandlerFn;
use crate::ecs::extension::Extension;
use crate::ecs::phase::PRE_UPDATE as PRE_UPDATE_PHASE;
-use crate::ecs::sole::Sole;
use crate::ecs::system::initializable::Initializable;
-use crate::ecs::system::observer::Observer;
-use crate::ecs::system::{Into, System};
-use crate::ecs::uid::Uid;
-use crate::ecs::{SoleAlreadyExistsError, World};
+use crate::ecs::system::Into;
+use crate::ecs::World;
use crate::shader::Extension as ShaderExtension;
mod util;
@@ -87,42 +84,16 @@ impl Engine
Self { world }
}
- pub fn spawn<Comps>(&mut self, components: Comps) -> Uid
- where
- Comps: ComponentSequence,
+ pub fn with_error_handler(mut self, error_handler: ErrorHandlerFn) -> Self
{
- self.world.create_entity(components)
+ self.world.set_err_handler(error_handler);
+ self
}
- pub fn register_system<'this, SystemImpl>(
- &'this mut self,
- phase_euid: Uid,
- system: impl System<'this, SystemImpl>,
- )
- {
- self.world.register_system(phase_euid, system);
- }
-
- pub fn register_observer<'this, SystemImpl>(
- &'this mut self,
- observer: impl Observer<'this, SystemImpl>,
- )
- {
- self.world.register_observer(observer);
- }
-
- /// Adds a globally shared singleton value.
- ///
- /// # Errors
- /// Returns `Err` if this [`Sole`] has already been added.
- pub fn add_sole(&mut self, sole: impl Sole) -> Result<(), SoleAlreadyExistsError>
- {
- self.world.add_sole(sole)
- }
-
- pub fn add_extension(&mut self, extension: impl Extension)
+ pub fn with_extension(mut self, extension: impl Extension) -> Self
{
self.world.add_extension(extension);
+ self
}
/// Runs the event loop.