Convert FreeSpaceControl to EntityComponent
This commit is contained in:
parent
75d98aad6b
commit
d78574f54a
5 changed files with 33 additions and 14 deletions
|
@ -1,4 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use context::prelude::cgmath::*;
|
||||
use ecs::{ComponentDebug, EntityComponent, World};
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
pub struct FreeSpaceControlSettings {
|
||||
|
@ -156,3 +159,25 @@ impl FreeSpaceControl {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl EntityComponent for FreeSpaceControl {
|
||||
fn enable(&mut self, _world: &mut World) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn disable(&mut self, _world: &mut World) -> Result<()> {
|
||||
self.last_update = None;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
Self::debug_name()
|
||||
}
|
||||
}
|
||||
|
||||
impl ComponentDebug for FreeSpaceControl {
|
||||
fn debug_name() -> &'static str {
|
||||
"FreeSpaceControl"
|
||||
}
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
pub mod animation;
|
||||
|
||||
pub mod draw;
|
||||
|
||||
pub mod particle_system;
|
||||
|
||||
pub mod bounding_box;
|
||||
|
||||
pub mod audio;
|
||||
pub mod bounding_box;
|
||||
pub mod draw;
|
||||
pub mod free_space_control;
|
||||
pub mod location;
|
||||
pub mod particle_system;
|
||||
|
||||
// angle of current object
|
||||
pub fn angle(v1: crate::prelude::cgmath::Vector2<f32>) -> crate::prelude::cgmath::Rad<f32> {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
pub use super::components::{animation::Animation, audio::Audio, draw::Draw};
|
||||
|
||||
pub use super::components::{
|
||||
audio::{ON_DISABLE_SOUND, ON_ENABLE_SOUND},
|
||||
animation::Animation,
|
||||
audio::{Audio, ON_DISABLE_SOUND, ON_ENABLE_SOUND},
|
||||
bounding_box::BoundingBox,
|
||||
draw::Draw,
|
||||
free_space_control::*,
|
||||
location::Location,
|
||||
particle_system::*,
|
||||
};
|
||||
|
||||
// pub use super::query::SceneQuery;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pub mod camera;
|
||||
pub mod free_camera_control;
|
||||
pub mod free_space_control;
|
||||
pub mod light;
|
||||
pub mod prelude;
|
||||
pub mod top_down_camera_control;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pub use super::camera::*;
|
||||
pub use super::free_camera_control::*;
|
||||
pub use super::free_space_control::*;
|
||||
pub use super::light::*;
|
||||
pub use super::top_down_camera_control::*;
|
||||
pub use super::validcommandbuffer::*;
|
||||
|
|
Loading…
Reference in a new issue