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
46
47
48
49
50
51
52
use crate::graphics::point::Point;
use crate::graphics::rectangle::Rectangle;
#[derive(Debug, PartialEq, Clone)]
pub struct Quad {
pub source: Rectangle<f32>,
pub position: Point,
pub size: (f32, f32),
}
impl Default for Quad {
fn default() -> Self {
Self {
source: Rectangle {
x: 0.0,
y: 0.0,
width: 1.0,
height: 1.0,
},
position: Point::new(0.0, 0.0),
size: (1.0, 1.0),
}
}
}
pub trait IntoQuad {
fn into_quad(self, x_unit: f32, y_unit: f32) -> Quad;
}
impl IntoQuad for Quad {
fn into_quad(self, _x_unit: f32, _y_unit: f32) -> Quad {
self
}
}