//! General game actions
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct Ping {
    /// Which texture got pinged
    pub texture: String,
    /// Where the ping occured in the window
    pub pos: (i32, i32),
}

#[derive(Serialize, Deserialize)]
pub struct ShowImage {
    /// Which texture to show
    pub texture: String,
}

#[derive(Serialize, Deserialize, Clone)]
pub struct SpawnToken {
    pub token_id: usize,
    pub x: f32,
    pub y: f32,
    pub img: String,
}
impl std::fmt::Debug for SpawnToken {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        // I dont want it to print the `img` field because it is VERY long :)
        f.debug_struct("SpawnToken")
            .field("token_id", &self.token_id)
            .field("x", &self.x)
            .field("y", &self.y)
            .finish()
    }
}
