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
extern crate failure;
#[macro_use]
extern crate log;
extern crate specs;
#[macro_use]
extern crate vulkano;
#[macro_use]
extern crate vulkano_shader_derive;
extern crate vulkano_win;
extern crate winit;
pub mod d2;
pub mod d3;
mod color;
mod render;
mod sys;
pub use self::color::Color;
pub use self::render::Renderer;
pub use self::sys::RenderBundle;
#[derive(Copy, Clone, Debug)]
pub struct ScreenDimensions {
pub w: u32,
pub h: u32,
}
impl Into<[u32; 2]> for ScreenDimensions {
fn into(self) -> [u32; 2] {
[self.w, self.h]
}
}
impl From<[u32; 2]> for ScreenDimensions {
fn from(arr: [u32; 2]) -> Self {
ScreenDimensions {
w: arr[0],
h: arr[1],
}
}
}
fn quit<F: Into<failure::Error>, T>(err: F) -> T {
panic!(err.into())
}
fn quit_msg<S: Into<String>, T>(msg: S) -> T {
quit(failure::err_msg(msg.into()))
}