spring_ai_rs/ai_interface/callback/command/command_data/
debug_drawer.rs1use std::ffi::CString;
2
3use spring_ai_sys::{
4 SAddOverlayTextureDrawerDebugCommand, SAddPointLineGraphDrawerDebugCommand,
5 SDeleteOverlayTextureDrawerDebugCommand, SDeletePointsLineGraphDrawerDebugCommand,
6 SSetColorLineGraphDrawerDebugCommand, SSetLabelLineGraphDrawerDebugCommand,
7 SSetLabelOverlayTextureDrawerDebugCommand, SSetPositionGraphDrawerDebugCommand,
8 SSetPositionOverlayTextureDrawerDebugCommand, SSetSizeGraphDrawerDebugCommand,
9 SSetSizeOverlayTextureDrawerDebugCommand, SUpdateOverlayTextureDrawerDebugCommand,
10};
11
12use crate::ai_interface::callback::command::command_data::{CData, CommandData};
13
14pub struct AddPointLineGraphDrawerDebugCommandData {
16 pub line_id: i32,
17 pub x: f32,
18 pub y: f32,
19}
20
21impl CommandData for AddPointLineGraphDrawerDebugCommandData {
22 type CDataType = SAddPointLineGraphDrawerDebugCommand;
23
24 fn c_data(&mut self) -> Self::CDataType {
25 SAddPointLineGraphDrawerDebugCommand {
26 lineId: self.line_id,
27 x: self.x,
28 y: self.y,
29 }
30 }
31}
32
33impl CData for SAddPointLineGraphDrawerDebugCommand {}
34
35pub struct DeletePointsLineGraphDrawerDebugCommandData {
37 pub line_id: i32,
38 pub num_points: i32,
39}
40
41impl CommandData for DeletePointsLineGraphDrawerDebugCommandData {
42 type CDataType = SDeletePointsLineGraphDrawerDebugCommand;
43
44 fn c_data(&mut self) -> Self::CDataType {
45 SDeletePointsLineGraphDrawerDebugCommand {
46 lineId: self.line_id,
47 numPoints: self.num_points,
48 }
49 }
50}
51
52impl CData for SDeletePointsLineGraphDrawerDebugCommand {}
53
54pub struct SetColorLineGraphDrawerDebugCommandData {
56 pub line_id: i32,
57 pub color: [i16; 3],
58}
59
60impl CommandData for SetColorLineGraphDrawerDebugCommandData {
61 type CDataType = SSetColorLineGraphDrawerDebugCommand;
62
63 fn c_data(&mut self) -> Self::CDataType {
64 SSetColorLineGraphDrawerDebugCommand {
65 lineId: self.line_id,
66 color_colorS3: self.color.as_mut_ptr(),
67 }
68 }
69}
70
71impl CData for SSetColorLineGraphDrawerDebugCommand {}
72
73pub struct SetLabelLineGraphDrawerDebugCommandData {
75 pub line_id: i32,
76 pub label: CString,
77}
78
79impl CommandData for SetLabelLineGraphDrawerDebugCommandData {
80 type CDataType = SSetLabelLineGraphDrawerDebugCommand;
81
82 fn c_data(&mut self) -> Self::CDataType {
83 SSetLabelLineGraphDrawerDebugCommand {
84 lineId: self.line_id,
85 label: self.label.as_ptr(),
86 }
87 }
88}
89
90impl CData for SSetLabelLineGraphDrawerDebugCommand {}
91
92pub struct SetPositionGraphDrawerDebugCommandData {
94 pub x: f32,
95 pub y: f32,
96}
97
98impl CommandData for SetPositionGraphDrawerDebugCommandData {
99 type CDataType = SSetPositionGraphDrawerDebugCommand;
100
101 fn c_data(&mut self) -> Self::CDataType {
102 SSetPositionGraphDrawerDebugCommand {
103 x: self.x,
104 y: self.y,
105 }
106 }
107}
108
109impl CData for SSetPositionGraphDrawerDebugCommand {}
110
111pub struct SetSizeGraphDrawerDebugCommandData {
113 pub w: f32,
114 pub h: f32,
115}
116
117impl CommandData for SetSizeGraphDrawerDebugCommandData {
118 type CDataType = SSetSizeGraphDrawerDebugCommand;
119
120 fn c_data(&mut self) -> Self::CDataType {
121 SSetSizeGraphDrawerDebugCommand {
122 w: self.w,
123 h: self.h,
124 }
125 }
126}
127
128impl CData for SSetSizeGraphDrawerDebugCommand {}
129
130pub struct AddOverlayTextureDrawerDebugCommandData {
132 pub texture_data: Vec<f32>,
133 pub w: i32,
134 pub h: i32,
135}
136
137impl CommandData for AddOverlayTextureDrawerDebugCommandData {
138 type CDataType = SAddOverlayTextureDrawerDebugCommand;
139
140 fn c_data(&mut self) -> Self::CDataType {
141 SAddOverlayTextureDrawerDebugCommand {
142 texData: self.texture_data.as_ptr(),
143 w: self.w,
144 h: self.h,
145 ret_overlayTextureId: 0,
146 }
147 }
148}
149
150impl CData for SAddOverlayTextureDrawerDebugCommand {}
151
152pub struct DeleteOverlayTextureDrawerDebugCommandData {
154 pub overlay_texture_id: i32,
155}
156
157impl CommandData for DeleteOverlayTextureDrawerDebugCommandData {
158 type CDataType = SDeleteOverlayTextureDrawerDebugCommand;
159
160 fn c_data(&mut self) -> Self::CDataType {
161 SDeleteOverlayTextureDrawerDebugCommand {
162 overlayTextureId: self.overlay_texture_id,
163 }
164 }
165}
166
167impl CData for SDeleteOverlayTextureDrawerDebugCommand {}
168
169pub struct SetLabelOverlayTextureDrawerDebugCommandData {
171 pub overlay_texture_id: i32,
172 pub label: CString,
173}
174
175impl CommandData for SetLabelOverlayTextureDrawerDebugCommandData {
176 type CDataType = SSetLabelOverlayTextureDrawerDebugCommand;
177
178 fn c_data(&mut self) -> Self::CDataType {
179 SSetLabelOverlayTextureDrawerDebugCommand {
180 overlayTextureId: self.overlay_texture_id,
181 label: self.label.as_ptr(),
182 }
183 }
184}
185
186impl CData for SSetLabelOverlayTextureDrawerDebugCommand {}
187
188pub struct SetPositionOverlayTextureDrawerDebugCommandData {
190 pub overlay_texture_id: i32,
191 pub x: f32,
192 pub y: f32,
193}
194
195impl CommandData for SetPositionOverlayTextureDrawerDebugCommandData {
196 type CDataType = SSetPositionOverlayTextureDrawerDebugCommand;
197
198 fn c_data(&mut self) -> Self::CDataType {
199 SSetPositionOverlayTextureDrawerDebugCommand {
200 overlayTextureId: self.overlay_texture_id,
201 x: self.x,
202 y: self.y,
203 }
204 }
205}
206
207impl CData for SSetPositionOverlayTextureDrawerDebugCommand {}
208
209pub struct SetSizeOverlayTextureDrawerDebugCommandData {
211 pub overlay_texture_id: i32,
212 pub w: f32,
213 pub h: f32,
214}
215
216impl CommandData for SetSizeOverlayTextureDrawerDebugCommandData {
217 type CDataType = SSetSizeOverlayTextureDrawerDebugCommand;
218
219 fn c_data(&mut self) -> Self::CDataType {
220 SSetSizeOverlayTextureDrawerDebugCommand {
221 overlayTextureId: self.overlay_texture_id,
222 w: self.w,
223 h: self.h,
224 }
225 }
226}
227
228impl CData for SSetSizeOverlayTextureDrawerDebugCommand {}
229
230pub struct UpdateOverlayTextureDrawerDebugCommandData {
232 pub overlay_texture_id: i32,
233 pub tex_data: Vec<f32>,
234 pub x: i32,
235 pub y: i32,
236 pub w: i32,
237 pub h: i32,
238}
239
240impl CommandData for UpdateOverlayTextureDrawerDebugCommandData {
241 type CDataType = SUpdateOverlayTextureDrawerDebugCommand;
242
243 fn c_data(&mut self) -> Self::CDataType {
244 SUpdateOverlayTextureDrawerDebugCommand {
245 overlayTextureId: self.overlay_texture_id,
246 texData: self.tex_data.as_ptr(),
247 x: self.x,
248 y: self.y,
249 w: self.w,
250 h: self.h,
251 }
252 }
253}
254
255impl CData for SUpdateOverlayTextureDrawerDebugCommand {}