From 4fb356822ef98241d2e44b0b0bd31d7f214f9f20 Mon Sep 17 00:00:00 2001 From: lamp Date: Sun, 5 Mar 2023 21:27:40 +0000 Subject: init --- src/util.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/util.rs (limited to 'src/util.rs') 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, + pub texture: Rc, + pub vertical_offset: f64, + pub scale_factor: Vec2, + pub distance_from_camera: f64, +} -- cgit v1.2.3