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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use crate::{
c::{spEvent, spEventData},
c_interface::{NewFromPtr, SyncPtr},
};
#[allow(unused_imports)]
use crate::AnimationState;
#[derive(Debug)]
pub struct Event {
c_event: SyncPtr<spEvent>,
}
impl NewFromPtr<spEvent> for Event {
unsafe fn new_from_ptr(c_event: *const spEvent) -> Self {
Self {
c_event: SyncPtr(c_event as *mut spEvent),
}
}
}
impl Event {
c_accessor_tmp_ptr!(data, data_mut, data, EventData, spEventData);
c_accessor!(time, time, f32);
c_accessor!(int_value, intValue, i32);
c_accessor!(float_value, floatValue, f32);
c_accessor_string!(string_value, stringValue);
c_accessor!(volume, volume, f32);
c_accessor!(balance, balance, f32);
c_ptr!(c_event, spEvent);
}
#[derive(Debug)]
pub struct EventData {
c_event_data: SyncPtr<spEventData>,
}
impl NewFromPtr<spEventData> for EventData {
unsafe fn new_from_ptr(c_event_data: *const spEventData) -> Self {
Self {
c_event_data: SyncPtr(c_event_data as *mut spEventData),
}
}
}
impl EventData {
c_accessor_string!(name, name);
c_accessor!(int_value, intValue, i32);
c_accessor!(float_value, floatValue, f32);
c_accessor_string!(string_value, stringValue);
c_accessor_string!(audio_path, audioPath);
c_accessor!(volume, volume, f32);
c_accessor!(balance, balance, f32);
c_ptr!(c_event_data, spEventData);
}