1use ::serde::{Deserialize, Serialize};
2
3use crate::helpers::{buffer_to_hex, hex_to_buffer};
4use crate::ColorTransformWithAlpha;
5use crate::Filter;
6use crate::Matrix;
7use crate::{BlendMode, SoundInfo};
8
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "snake_case")]
11pub struct ButtonRecord {
12 pub state_up: bool,
13 pub state_over: bool,
14 pub state_down: bool,
15 pub state_hit_test: bool,
16 pub character_id: u16,
17 pub depth: u16,
18 pub matrix: Matrix,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub color_transform: Option<ColorTransformWithAlpha>,
21 pub filters: Vec<Filter>,
22 pub blend_mode: BlendMode,
23}
24
25#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
26#[serde(rename_all = "snake_case")]
27pub struct ButtonCondAction {
28 #[serde(skip_serializing_if = "Option::is_none")]
29 pub conditions: Option<ButtonCond>,
30 #[serde(serialize_with = "buffer_to_hex", deserialize_with = "hex_to_buffer")]
31 pub actions: Vec<u8>,
32}
33
34#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
35#[serde(rename_all = "snake_case")]
36pub struct ButtonCond {
37 pub idle_to_over_up: bool,
38 pub over_up_to_idle: bool,
39 pub over_up_to_over_down: bool,
40 pub over_down_to_over_up: bool,
41 pub over_down_to_out_down: bool,
42 pub out_down_to_over_down: bool,
43 pub out_down_to_idle: bool,
44 pub idle_to_over_down: bool,
45 pub over_down_to_idle: bool,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 pub key_press: Option<u32>,
48}
49
50#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
51#[serde(rename_all = "snake_case")]
52pub struct ButtonSound {
53 pub sound_id: u16,
54 pub sound_info: SoundInfo,
55}