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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#![allow(clippy::needless_doctest_main, clippy::collapsible_if)]
#![deny(
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unstable_features,
unused_import_braces,
unused_qualifications
)]
mod board;
pub use crate::board::*;
mod chess;
pub use crate::chess::*;
mod piece;
pub use crate::piece::*;
mod color;
pub use crate::color::*;
mod castle_rights;
pub use crate::castle_rights::*;
mod error;
pub use crate::error::*;
mod config;
pub use crate::config::*;
mod square;
pub use crate::square::*;
mod file;
pub use crate::file::*;
mod rank;
pub use crate::rank::*;
mod chess_move;
pub use crate::chess_move::*;
mod direction;
pub use crate::direction::*;
mod chess_gui;
pub use crate::chess_gui::*;
mod button;
pub use crate::button::*;
mod theme;
pub use crate::theme::*;
pub fn run(game: ChessGui) {
let default_conf = ggez::conf::Conf {
window_mode: ggez::conf::WindowMode::default()
.dimensions(SCREEN_PX_SIZE.0, SCREEN_PX_SIZE.1),
window_setup: ggez::conf::WindowSetup::default()
.title("Chess")
.icon("/images/icon.png"),
backend: ggez::conf::Backend::default(),
modules: ggez::conf::ModuleConf {
gamepad: false,
audio: false,
},
};
let (ctx, event_loop) =
ggez::ContextBuilder::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_AUTHORS"))
.add_resource_path::<std::path::PathBuf>(
[env!("CARGO_MANIFEST_DIR"), "resources"].iter().collect(),
)
.default_conf(default_conf)
.build()
.expect("Failed to build ggez context");
ggez::event::run(ctx, event_loop, game)
}