diff options
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..dcd2b72 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,45 @@ +use std::rc::Rc; + +use crate::vec2::Vec2; +use crate::texture::Texture; + +#[derive(Clone)] +pub enum Side { + X, + Y, +} + +pub enum Orientation { + XAxis, + YAxis, +} + +#[derive(Clone)] +pub enum Step { + Left, + Right, +} + +impl Step { + pub fn value(&self) -> i32 { + match self { + Step::Left => -1, + Step::Right => 1, + } + } + + pub fn from(value: bool) -> Step { + match value { + true => Step::Left, + false => Step::Right, + } + } +} + +pub struct Sprite { + pub position: Vec2<f64>, + pub texture: Rc<Texture>, + pub vertical_offset: f64, + pub scale_factor: Vec2<f64>, + pub distance_from_camera: f64, +} |