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
53
use gl;
use maths::Vector2u;
use std::cmp::Ordering;
mod batches;
pub mod camera;
pub mod manager;
pub mod mesh;
pub mod shaders;
pub mod sprites;
pub type TextureID = gl::types::GLuint;
pub type ProgramID = gl::types::GLuint;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Texture {
id: TextureID,
size: Vector2u,
}
impl PartialOrd for Texture {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Texture {
fn cmp(&self, other: &Self) -> Ordering {
self.id.cmp(&other.id)
}
}
impl Texture {
pub fn id(&self) -> gl::types::GLuint {
self.id
}
pub fn size(&self) -> Vector2u {
self.size
}
pub fn width(&self) -> u32 {
self.size.x
}
pub fn height(&self) -> u32 {
self.size.y
}
}