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
//! The configuration format for the program container

use typedef::*;

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayConfig {
    pub resolution: DisplayResolution,
    pub default_scale: Float,
}

impl Default for DisplayConfig {
    fn default() -> Self {
        DisplayConfig {
            resolution: Default::default(),
            default_scale: 4.0,
        }
    }
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayResolution {
    pub width: usize,
    pub height: usize,
}

impl Default for DisplayResolution {
    fn default() -> Self {
        DisplayResolution {
            width: 160,
            height: 100,
        }
    }
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Config {
    pub title: String,
    pub display: DisplayConfig,
    pub keyboard_enabled: bool,
    pub mouse_enabled: bool,
}

impl Default for Config {
    fn default() -> Self {
        Config {
            title: "bakerVM".into(),
            display: Default::default(),
            keyboard_enabled: true,
            mouse_enabled: true,
        }
    }
}