aboutsummaryrefslogtreecommitdiff
path: root/core/src/data/game/structs.rs
blob: 52fc0f16f58439d53ad12f611e175add836f0edf (plain) (blame)
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
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::data::game::types::GameInfo;
use crate::data::player::structs::Account;

/// Game pad_client data
/// Describes the basic information of the game pad_client
#[derive(Clone, Serialize, Deserialize, PartialEq, Debug)]
pub struct GameData {
    pub info: GameInfo,
    pub control: GameControlData,
    pub archive: GameRuntimeDataArchive
}

/// Game control information
/// Describes the buttons, axes, and directions that can be controlled.
#[derive(Default, Clone, Serialize, Deserialize, PartialEq, Debug)]
pub struct GameControlData {
    pub direction_keys : HashMap<u8, String>,
    pub axis_keys : HashMap<u8, String>,
    pub button_keys : HashMap<u8, String>,
}

/// Archive of game runtime data
/// The game pad_client can convert data into this structure for persistence.
#[derive(Default, Clone, Serialize, Deserialize, PartialEq, Debug)]
pub struct GameRuntimeDataArchive {
    pub banned: Vec<Account>
}