rustle_bird/
config.rs

1pub struct Config {
2    /// game window width
3    pub width: u32,
4
5    /// game window height
6    pub height: u32,
7
8    /// acceleration of gravity that pulls bird down
9    pub gravity: f64,
10
11    /// init speed after flap
12    pub flap_speed: f64,
13
14    /// horizontal length of pipe
15    pub pipe_width: u32,
16
17    /// horizontal space between two pipes
18    pub pipe_interval: u32,
19
20    /// vertical space between pipes
21    pub pipe_mouth_height: u32,
22
23    /// speed of pipe
24    pub pipe_speed: f64,
25}
26
27impl Default for Config {
28    fn default() -> Self {
29        Self {
30            width: 80,
31            height: 24,
32            gravity: 0.005,
33            #[allow(deprecated)]
34            flap_speed: 0.2,
35            pipe_width: 5,
36            pipe_interval: 40,
37            pipe_mouth_height: 10,
38            pipe_speed: 0.3,
39        }
40    }
41}
42
43use lazy_static::lazy_static;
44lazy_static! {
45    pub static ref CONFIG: Config = Config::default();
46}