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
//! Vector2 u32.
mod operators;
/// Simple u32 Vector2.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Vec2u32 {
/// X value.
pub x: u32,
/// Y value.
pub y: u32
}
impl Vec2u32 {
/// Creates a new [`Vec2u32 with`] x and y defined.
///
/// use `default()` for a 0 initialized.
pub fn new(x: u32, y: u32) -> Self {
Self{
x,
y
}
}
/// Puts x into y and y into x
pub fn flip(&mut self){
let tmp = self.x;
self.x = self.y;
self.y = tmp;
}
}
impl Default for Vec2u32 {
/// Creates a new [`Vec2u32`] with x and y initialized with 0.
fn default() -> Self {
Self{
x: 0,
y: 0
}
}
}