|
- use glc::vector::Vector2f;
- use serde::{Deserialize, Serialize};
- use specs::{Component, VecStorage};
-
- #[derive(Clone, Debug, Default, Serialize, Deserialize)]
- pub struct Velocity {
- dir: Vector2f,
- speed: f32,
- }
-
- /* Velocity */
-
- impl Velocity {
- pub fn dir(&self) -> &Vector2f {
- &self.dir
- }
-
- pub fn speed(&self) -> f32 {
- self.speed
- }
- }
-
- impl Velocity {
- pub(crate) fn new(dir: Vector2f, speed: f32) -> Self {
- Self { dir, speed }
- }
-
- pub(crate) fn dir_mut(&mut self) -> &mut Vector2f {
- &mut self.dir
- }
- }
-
- impl Component for Velocity {
- type Storage = VecStorage<Self>;
- }
|