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