1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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,
}
|