1#[repr(C)]
2#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub struct __BindgenBitfieldUnit<Storage> {
4 storage: Storage,
5}
6impl<Storage> __BindgenBitfieldUnit<Storage> {
7 #[inline]
8 pub const fn new(storage: Storage) -> Self { Self { storage } }
9}
10impl<Storage> __BindgenBitfieldUnit<Storage> where Storage: AsRef<[u8]> + AsMut<[u8]> {
11 #[inline]
12 fn extract_bit(byte: u8, index: usize) -> bool {
13 let bit_index = if cfg!(target_endian = "big") {
14 7 - (index % 8)
15 } else {
16 index % 8
17 };
18 let mask = 1 << bit_index;
19 byte & mask == mask
20 }
21 #[inline]
22 pub fn get_bit(&self, index: usize) -> bool {
23 debug_assert!(index / 8 < self.storage.as_ref().len());
24 let byte_index = index / 8;
25 let byte = self.storage.as_ref()[byte_index];
26 Self::extract_bit(byte, index)
27 }
28 #[inline]
29 pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
30 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
31 let byte_index = index / 8;
32 let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
33 Self::extract_bit(byte, index)
34 }
35 #[inline]
36 fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
37 let bit_index = if cfg!(target_endian = "big") {
38 7 - (index % 8)
39 } else {
40 index % 8
41 };
42 let mask = 1 << bit_index;
43 if val { byte | mask } else { byte & !mask }
44 }
45 #[inline]
46 pub fn set_bit(&mut self, index: usize, val: bool) {
47 debug_assert!(index / 8 < self.storage.as_ref().len());
48 let byte_index = index / 8;
49 let byte = &mut self.storage.as_mut()[byte_index];
50 *byte = Self::change_bit(*byte, index, val);
51 }
52 #[inline]
53 pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
54 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
55 let byte_index = index / 8;
56 let byte = (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
57 *byte = Self::change_bit(*byte, index, val);
58 }
59 #[inline]
60 pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
61 debug_assert!(bit_width <= 64);
62 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
63 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
64 let mut val = 0;
65 for i in 0..(bit_width as usize) {
66 if self.get_bit(i + bit_offset) {
67 let index = if cfg!(target_endian = "big") {
68 bit_width as usize - 1 - i
69 } else {
70 i
71 };
72 val |= 1 << index;
73 }
74 }
75 val
76 }
77 #[inline]
78 pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
79 debug_assert!(bit_width <= 64);
80 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
81 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
82 let mut val = 0;
83 for i in 0..(bit_width as usize) {
84 if Self::raw_get_bit(this, i + bit_offset) {
85 let index = if cfg!(target_endian = "big") {
86 bit_width as usize - 1 - i
87 } else {
88 i
89 };
90 val |= 1 << index;
91 }
92 }
93 val
94 }
95 #[inline]
96 pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
97 debug_assert!(bit_width <= 64);
98 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
99 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
100 for i in 0..(bit_width as usize) {
101 let mask = 1 << i;
102 let val_bit_is_set = val & mask == mask;
103 let index = if cfg!(target_endian = "big") {
104 bit_width as usize - 1 - i
105 } else {
106 i
107 };
108 self.set_bit(index + bit_offset, val_bit_is_set);
109 }
110 }
111 #[inline]
112 pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
113 debug_assert!(bit_width <= 64);
114 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
115 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
116 for i in 0..(bit_width as usize) {
117 let mask = 1 << i;
118 let val_bit_is_set = val & mask == mask;
119 let index = if cfg!(target_endian = "big") {
120 bit_width as usize - 1 - i
121 } else {
122 i
123 };
124 Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
125 }
126 }
127}
128pub const LCD_COLUMNS: u32 = 400;
129pub const LCD_ROWS: u32 = 240;
130pub const LCD_ROWSIZE: u32 = 52;
131pub const SEEK_SET: u32 = 0;
132pub const SEEK_CUR: u32 = 1;
133pub const SEEK_END: u32 = 2;
134pub const AUDIO_FRAMES_PER_CYCLE: u32 = 512;
135pub const NOTE_C4: u32 = 60;
136#[repr(C)]
137#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
138#[must_use]
139pub struct LCDRect {
140 pub left: core::ffi::c_int,
141 pub right: core::ffi::c_int,
142 pub top: core::ffi::c_int,
143 pub bottom: core::ffi::c_int,
144}
145#[allow(clippy::unnecessary_operation, clippy::identity_op)]
146const _: () = {
147 ["Size of LCDRect"][::core::mem::size_of::<LCDRect>() - 16usize];
148 ["Alignment of LCDRect"][::core::mem::align_of::<LCDRect>() - 4usize];
149 ["Offset of field: LCDRect::left"][::core::mem::offset_of!(LCDRect, left) - 0usize];
150 ["Offset of field: LCDRect::right"][::core::mem::offset_of!(LCDRect, right) - 4usize];
151 ["Offset of field: LCDRect::top"][::core::mem::offset_of!(LCDRect, top) - 8usize];
152 ["Offset of field: LCDRect::bottom"][::core::mem::offset_of!(LCDRect, bottom) - 12usize];
153};
154#[repr(u8)]
155#[must_use]
156#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
157pub enum LCDBitmapDrawMode {
158 kDrawModeCopy = 0,
159 kDrawModeWhiteTransparent = 1,
160 kDrawModeBlackTransparent = 2,
161 kDrawModeFillWhite = 3,
162 kDrawModeFillBlack = 4,
163 kDrawModeXOR = 5,
164 kDrawModeNXOR = 6,
165 kDrawModeInverted = 7,
166}
167#[repr(u8)]
168#[must_use]
169#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
170pub enum LCDBitmapFlip {
171 kBitmapUnflipped = 0,
172 kBitmapFlippedX = 1,
173 kBitmapFlippedY = 2,
174 kBitmapFlippedXY = 3,
175}
176#[repr(u8)]
177#[must_use]
178#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
179pub enum LCDSolidColor {
180 kColorBlack = 0,
181 kColorWhite = 1,
182 kColorClear = 2,
183 kColorXOR = 3,
184}
185#[repr(u8)]
186#[must_use]
187#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
188pub enum LCDLineCapStyle {
189 kLineCapStyleButt = 0,
190 kLineCapStyleSquare = 1,
191 kLineCapStyleRound = 2,
192}
193#[repr(u8)]
194#[must_use]
195#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
196pub enum PDStringEncoding {
197 kASCIIEncoding = 0,
198 kUTF8Encoding = 1,
199 k16BitLEEncoding = 2,
200}
201pub type LCDPattern = [u8; 16usize];
202pub type LCDColor = usize;
203#[repr(u8)]
204#[must_use]
205#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
206pub enum LCDPolygonFillRule {
207 kPolygonFillNonZero = 0,
208 kPolygonFillEvenOdd = 1,
209}
210#[repr(u8)]
211#[must_use]
212#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
213pub enum PDTextWrappingMode {
214 kWrapClip = 0,
215 kWrapCharacter = 1,
216 kWrapWord = 2,
217}
218#[repr(u8)]
219#[must_use]
220#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
221pub enum PDTextAlignment {
222 kAlignTextLeft = 0,
223 kAlignTextCenter = 1,
224 kAlignTextRight = 2,
225}
226#[repr(C)]
227#[derive(Debug, Copy, Clone)]
228#[must_use]
229pub struct LCDBitmap {
230 _unused: [u8; 0],
231}
232#[repr(C)]
233#[derive(Debug, Copy, Clone)]
234#[must_use]
235pub struct LCDBitmapTable {
236 _unused: [u8; 0],
237}
238#[repr(C)]
239#[derive(Debug, Copy, Clone)]
240#[must_use]
241pub struct LCDFont {
242 _unused: [u8; 0],
243}
244#[repr(C)]
245#[derive(Debug, Copy, Clone)]
246#[must_use]
247pub struct LCDFontData {
248 _unused: [u8; 0],
249}
250#[repr(C)]
251#[derive(Debug, Copy, Clone)]
252#[must_use]
253pub struct LCDFontPage {
254 _unused: [u8; 0],
255}
256#[repr(C)]
257#[derive(Debug, Copy, Clone)]
258#[must_use]
259pub struct LCDFontGlyph {
260 _unused: [u8; 0],
261}
262#[repr(C)]
263#[derive(Debug, Copy, Clone)]
264#[must_use]
265pub struct LCDVideoPlayer {
266 _unused: [u8; 0],
267}
268#[repr(C)]
269#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
270#[must_use]
271pub struct playdate_video {
272 #[doc = "`LCDVideoPlayer playdate->graphics->video->loadVideo(const char* path)`\n\nOpens the *pdv* file at *path* and returns a new video player object for rendering its frames."]
273 pub loadVideo:
274 ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char) -> *mut LCDVideoPlayer>,
275 #[doc = "`void playdate->graphics->video->freePlayer(LCDVideoPlayer* p)`\n\nFrees the given video player."]
276 pub freePlayer: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer)>,
277 #[doc = "`int playdate->graphics->video->setContext(LCDVideoPlayer* p, LCDBitmap* context)`\n\nSets the rendering destination for the video player to the given bitmap. If the function fails, it returns 0 and sets an error message that can be read via [getError()](#f-graphics.video.getError)."]
278 pub setContext: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer,
279 context: *mut LCDBitmap)
280 -> core::ffi::c_int>,
281 #[doc = "`void playdate->graphics->video->useScreenContext(LCDVideoPlayer* p)`\n\nSets the rendering destination for the video player to the screen."]
282 pub useScreenContext: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer)>,
283 #[doc = "`void playdate->graphics->video->renderFrame(LCDVideoPlayer* p, int n)`\n\nRenders frame number *n* into the current context. In case of error, the function returns 0 and sets an error message that can be read via [getError()](#f-graphics.video.getError)."]
284 pub renderFrame: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer,
285 n: core::ffi::c_int)
286 -> core::ffi::c_int>,
287 #[doc = "`const char* playdate->graphics->video->getError(LCDVideoPlayer* p)`\n\nReturns text describing the most recent error."]
288 pub getError: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer) -> *const core::ffi::c_char>,
289 #[doc = "`void playdate->graphics->video->getInfo(LCDVideoPlayer* p, int* outWidth, int* outHeight, float* outFrameRate, int* outFrameCount, int* outCurrentFrame)`\n\nRetrieves information about the video, by passing in (possibly NULL) value pointers."]
290 pub getInfo: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer,
291 outWidth: *mut core::ffi::c_int,
292 outHeight: *mut core::ffi::c_int,
293 outFrameRate: *mut core::ffi::c_float,
294 outFrameCount: *mut core::ffi::c_int,
295 outCurrentFrame: *mut core::ffi::c_int)>,
296 #[doc = "`LCBitmap* playdate->graphics->video->getContext(LCDVideoPlayer* p)`\n\nGets the rendering destination for the video player. If no rendering context has been setallocates a context bitmap with the same dimensions as the vieo will be allocated."]
297 pub getContext: ::core::option::Option<unsafe extern "C" fn(p: *mut LCDVideoPlayer) -> *mut LCDBitmap>,
298}
299#[allow(clippy::unnecessary_operation, clippy::identity_op)]
300const _: () = {
301 ["Size of playdate_video"][::core::mem::size_of::<playdate_video>() - 32usize];
302 ["Alignment of playdate_video"][::core::mem::align_of::<playdate_video>() - 4usize];
303 ["Offset of field: playdate_video::loadVideo"][::core::mem::offset_of!(playdate_video, loadVideo) - 0usize];
304 ["Offset of field: playdate_video::freePlayer"][::core::mem::offset_of!(playdate_video, freePlayer) - 4usize];
305 ["Offset of field: playdate_video::setContext"][::core::mem::offset_of!(playdate_video, setContext) - 8usize];
306 ["Offset of field: playdate_video::useScreenContext"]
307 [::core::mem::offset_of!(playdate_video, useScreenContext) - 12usize];
308 ["Offset of field: playdate_video::renderFrame"]
309 [::core::mem::offset_of!(playdate_video, renderFrame) - 16usize];
310 ["Offset of field: playdate_video::getError"][::core::mem::offset_of!(playdate_video, getError) - 20usize];
311 ["Offset of field: playdate_video::getInfo"][::core::mem::offset_of!(playdate_video, getInfo) - 24usize];
312 ["Offset of field: playdate_video::getContext"][::core::mem::offset_of!(playdate_video, getContext) - 28usize];
313};
314#[repr(C)]
315#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
316#[must_use]
317pub struct playdate_graphics {
318 pub video: *const playdate_video,
319 #[doc = "`void playdate->graphics->clear(LCDColor color);`\n\nClears the entire display, filling it with *color*.\n\nEquivalent to [`playdate.graphics.clear()`](./Inside%20Playdate.html#f-graphics.clear) in the Lua API."]
320 pub clear: ::core::option::Option<unsafe extern "C" fn(color: LCDColor)>,
321 #[doc = "`void playdate->graphics->setBackgroundColor(LCDColor color);`\n\nSets the background color shown when the display is [offset](#f-display.setOffset) or for clearing dirty areas in the sprite system.\n\nEquivalent to [`playdate.graphics.setBackgroundColor()`](./Inside%20Playdate.html#f-graphics.setBackgroundColor) in the Lua API."]
322 pub setBackgroundColor: ::core::option::Option<unsafe extern "C" fn(color: LCDSolidColor)>,
323 #[doc = "`void playdate->graphics->setStencil(LCDBitmap* stencil);`\n\nSets the stencil used for drawing. For a tiled stencil, use *setStencilImage()* instead. To clear the stencil, set it to *NULL*."]
324 pub setStencil: ::core::option::Option<unsafe extern "C" fn(stencil: *mut LCDBitmap)>,
325 #[doc = "`LCDBitmapDrawMode playdate->graphics->setDrawMode(LCDBitmapDrawMode mode);`\n\nSets the mode used for drawing bitmaps. Note that text drawing uses bitmaps, so this affects how fonts are displayed as well. Returns the previous draw mode, in case you need to restore it after drawing.\n\nLCDBitmapDrawMode\n\n```cpp\ntypedef enum\n{\n\tkDrawModeCopy,\n\tkDrawModeWhiteTransparent,\n\tkDrawModeBlackTransparent,\n\tkDrawModeFillWhite,\n\tkDrawModeFillBlack,\n\tkDrawModeXOR,\n\tkDrawModeNXOR,\n\tkDrawModeInverted\n} LCDBitmapDrawMode;\n```\n\nEquivalent to [`playdate.graphics.setImageDrawMode()`](./Inside%20Playdate.html#f-graphics.setImageDrawMode) in the Lua API."]
326 pub setDrawMode: ::core::option::Option<unsafe extern "C" fn(mode: LCDBitmapDrawMode) -> LCDBitmapDrawMode>,
327 #[doc = "`void playdate->graphics->setDrawOffset(int dx, int dy);`\n\nOffsets the origin point for all drawing calls to *x*, *y* (can be negative).\n\nThis is useful, for example, for centering a \"camera\" on a sprite that is moving around a world larger than the screen.\n\nEquivalent to [`playdate.graphics.setDrawOffset()`](./Inside%20Playdate.html#f-graphics.setDrawOffset) in the Lua API."]
328 pub setDrawOffset: ::core::option::Option<unsafe extern "C" fn(dx: core::ffi::c_int, dy: core::ffi::c_int)>,
329 #[doc = "`void playdate->graphics->setClipRect(int x, int y, int width, int height);`\n\nSets the current clip rect, using world coordinates—\u{200b}that is, the given rectangle will be translated by the current drawing offset. The clip rect is cleared at the beginning of each update.\n\nEquivalent to [`playdate.graphics.setClipRect()`](./Inside%20Playdate.html#f-graphics.setClipRect) in the Lua API."]
330 pub setClipRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
331 y: core::ffi::c_int,
332 width: core::ffi::c_int,
333 height: core::ffi::c_int)>,
334 #[doc = "`void playdate->graphics->clearClipRect(void);`\n\nClears the current clip rect.\n\nEquivalent to [`playdate.graphics.clearClipRect()`](./Inside%20Playdate.html#f-graphics.clearClipRect) in the Lua API."]
335 pub clearClipRect: ::core::option::Option<unsafe extern "C" fn()>,
336 #[doc = "`void playdate->graphics->setLineCapStyle(LCDLineCapStyle endCapStyle);`\n\nSets the end cap style used in the line drawing functions.\n\nLCDLineCapStyle\n\n```cpp\ntypedef enum\n{\n\tkLineCapStyleButt,\n\tkLineCapStyleSquare,\n\tkLineCapStyleRound\n} LCDLineCapStyle;\n```\n\nEquivalent to [`playdate.graphics.setLineCapStyle()`](./Inside%20Playdate.html#f-graphics.setLineCapStyle) in the Lua API."]
337 pub setLineCapStyle: ::core::option::Option<unsafe extern "C" fn(endCapStyle: LCDLineCapStyle)>,
338 #[doc = "`void playdate->graphics->setFont(LCDFont* font);`\n\nSets the font to use in subsequent [drawText](#f-graphics.drawText) calls.\n\nEquivalent to [`playdate.graphics.setFont()`](./Inside%20Playdate.html#f-graphics.setFont) in the Lua API."]
339 pub setFont: ::core::option::Option<unsafe extern "C" fn(font: *mut LCDFont)>,
340 #[doc = "`void playdate->graphics->setTextTracking(int tracking);`\n\nSets the tracking to use when drawing text.\n\nEquivalent to [`playdate.graphics.font:setTracking()`](./Inside%20Playdate.html#m-graphics.font.setTracking) in the Lua API."]
341 pub setTextTracking: ::core::option::Option<unsafe extern "C" fn(tracking: core::ffi::c_int)>,
342 #[doc = "`void playdate->graphics->pushContext(LCDBitmap* target);`\n\nPush a new drawing context for drawing into the given bitmap. If *target* is *NULL*, the drawing functions will use the display framebuffer.\n\nEquivalent to [`playdate.graphics.pushContext()`](./Inside%20Playdate.html#f-graphics.pushContext) in the Lua API."]
343 pub pushContext: ::core::option::Option<unsafe extern "C" fn(target: *mut LCDBitmap)>,
344 #[doc = "`void playdate->graphics->popContext(void);`\n\nPops a context off the stack (if any are left), restoring the drawing settings from before the context was pushed.\n\nEquivalent to [`playdate.graphics.popContext()`](./Inside%20Playdate.html#f-graphics.popContext) in the Lua API."]
345 pub popContext: ::core::option::Option<unsafe extern "C" fn()>,
346 #[doc = "`void playdate->graphics->drawBitmap(LCDBitmap* bitmap, int x, int y, LCDBitmapFlip flip);`\n\nDraws the *bitmap* with its upper-left corner at location *x*, *y*, using the given flip orientation."]
347 pub drawBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
348 x: core::ffi::c_int,
349 y: core::ffi::c_int,
350 flip: LCDBitmapFlip)>,
351 #[doc = "`void playdate->graphics->tileBitmap(LCDBitmap* bitmap, int x, int y, int width, int height, LCDBitmapFlip flip);`\n\nDraws the *bitmap* with its upper-left corner at location *x*, *y* tiled inside a *width* by *height* rectangle."]
352 pub tileBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
353 x: core::ffi::c_int,
354 y: core::ffi::c_int,
355 width: core::ffi::c_int,
356 height: core::ffi::c_int,
357 flip: LCDBitmapFlip)>,
358 #[doc = "`void playdate->graphics->drawLine(int x1, int y1, int x2, int y2, int width, LCDColor color);`\n\nDraws a line from *x1*, *y1* to *x2*, *y2* with a stroke width of *width*.\n\nEquivalent to [`playdate.graphics.drawLine()`](./Inside%20Playdate.html#f-graphics.drawLine) in the Lua API."]
359 pub drawLine: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_int,
360 y1: core::ffi::c_int,
361 x2: core::ffi::c_int,
362 y2: core::ffi::c_int,
363 width: core::ffi::c_int,
364 color: LCDColor)>,
365 #[doc = "`void playdate->graphics->fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, LCDColor color);`\n\nDraws a filled triangle with points at *x1*, *y1*, *x2*, *y2*, and *x3*, *y3*.\n\nLCDWindingRule\n\n```cpp\ntypedef enum\n{\n\tkPolygonFillNonZero,\n\tkPolygonFillEvenOdd\n} LCDPolygonFillRule;\n```\n\nEquivalent to [`playdate.graphics.fillTriangle()`](./Inside%20Playdate.html#f-graphics.fillTriangle) in the Lua API."]
366 pub fillTriangle: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_int,
367 y1: core::ffi::c_int,
368 x2: core::ffi::c_int,
369 y2: core::ffi::c_int,
370 x3: core::ffi::c_int,
371 y3: core::ffi::c_int,
372 color: LCDColor)>,
373 #[doc = "`void playdate->graphics->drawRect(int x, int y, int width, int height, LCDColor color);`\n\nDraws a *width* by *height* rect at *x*, *y*.\n\nEquivalent to [`playdate.graphics.drawRect()`](./Inside%20Playdate.html#f-graphics.drawRect) in the Lua API."]
374 pub drawRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
375 y: core::ffi::c_int,
376 width: core::ffi::c_int,
377 height: core::ffi::c_int,
378 color: LCDColor)>,
379 #[doc = "`void playdate->graphics->fillRect(int x, int y, int width, int height, LCDColor color);`\n\nDraws a filled *width* by *height* rect at *x*, *y*.\n\nEquivalent to [`playdate.graphics.fillRect()`](./Inside%20Playdate.html#f-graphics.fillRect) in the Lua API."]
380 pub fillRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
381 y: core::ffi::c_int,
382 width: core::ffi::c_int,
383 height: core::ffi::c_int,
384 color: LCDColor)>,
385 #[doc = "`void playdate->graphics->drawEllipse(int x, int y, int width, int height, int lineWidth, float startAngle, float endAngle, LCDColor color);`\n\nDraws an ellipse inside the rectangle {x, y, width, height} of width *lineWidth* (inset from the rectangle bounds). If *startAngle* != \\_endAngle, this draws an arc between the given angles. Angles are given in degrees, clockwise from due north."]
386 pub drawEllipse: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
387 y: core::ffi::c_int,
388 width: core::ffi::c_int,
389 height: core::ffi::c_int,
390 lineWidth: core::ffi::c_int,
391 startAngle: core::ffi::c_float,
392 endAngle: core::ffi::c_float,
393 color: LCDColor)>,
394 #[doc = "`void playdate->graphics->fillEllipse(int x, int y, int width, int height, float startAngle, float endAngle, LCDColor color);`\n\nFills an ellipse inside the rectangle {x, y, width, height}. If *startAngle* != \\_endAngle, this draws a wedge/Pacman between the given angles. Angles are given in degrees, clockwise from due north."]
395 pub fillEllipse: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
396 y: core::ffi::c_int,
397 width: core::ffi::c_int,
398 height: core::ffi::c_int,
399 startAngle: core::ffi::c_float,
400 endAngle: core::ffi::c_float,
401 color: LCDColor)>,
402 #[doc = "`void playdate->graphics->drawScaledBitmap(LCDBitmap* bitmap, int x, int y, float xscale, float yscale);`\n\nDraws the *bitmap* scaled to *xscale* and *yscale* with its upper-left corner at location *x*, *y*. Note that *flip* is not available when drawing scaled bitmaps but negative scale values will achieve the same effect."]
403 pub drawScaledBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
404 x: core::ffi::c_int,
405 y: core::ffi::c_int,
406 xscale: core::ffi::c_float,
407 yscale: core::ffi::c_float)>,
408 #[doc = "`int playdate->graphics->drawText(const void* text, size_t len, PDStringEncoding encoding, int x, int y);`\n\nDraws the given text using the provided options. If no font has been set with [setFont](#f-graphics.setFont), the default system font Asheville Sans 14 Light is used. Note that `len` is the length of the **decoded** string—\u{200b}that is, the number of codepoints in the string, not the number of bytes; however, since the parser stops at the NUL terminator it’s safe to pass `strlen(text)` in here when you want to draw the entire string.\n\nEquivalent to [`playdate.graphics.drawText()`](./Inside%20Playdate.html#f-graphics.drawText) in the Lua API."]
409 pub drawText: ::core::option::Option<unsafe extern "C" fn(text: *const core::ffi::c_void,
410 len: usize,
411 encoding: PDStringEncoding,
412 x: core::ffi::c_int,
413 y: core::ffi::c_int)
414 -> core::ffi::c_int>,
415 #[doc = "`LCDBitmap* playdate->graphics->newBitmap(int width, int height, LCDColor bgcolor);`\n\nAllocates and returns a new *width* by *height* LCDBitmap filled with *bgcolor*."]
416 pub newBitmap: ::core::option::Option<unsafe extern "C" fn(width: core::ffi::c_int,
417 height: core::ffi::c_int,
418 bgcolor: LCDColor)
419 -> *mut LCDBitmap>,
420 #[doc = "`void playdate->graphics->freeBitmap(LCDBitmap*);`\n\nFrees the given *bitmap*."]
421 pub freeBitmap: ::core::option::Option<unsafe extern "C" fn(arg1: *mut LCDBitmap)>,
422 #[doc = "`LCDBitmap* playdate->graphics->loadBitmap(const char* path, const char** outerr);`\n\nAllocates and returns a new LCDBitmap from the file at *path*. If there is no file at *path*, the function returns null."]
423 pub loadBitmap: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char,
424 outerr: *mut *const core::ffi::c_char)
425 -> *mut LCDBitmap>,
426 #[doc = "`LCDBitmap* playdate->graphics->copyBitmap(LCDBitmap* bitmap);`\n\nReturns a new LCDBitmap that is an exact copy of *bitmap*."]
427 pub copyBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>,
428 #[doc = "`void playdate->graphics->loadIntoBitmap(const char* path, LCDBitmap* bitmap, const char** outerr);`\n\nLoads the image at *path* into the previously allocated *bitmap*."]
429 pub loadIntoBitmap: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char,
430 bitmap: *mut LCDBitmap,
431 outerr: *mut *const core::ffi::c_char)>,
432 #[doc = "`void playdate->graphics->getBitmapData(LCDBitmap* bitmap, int* width, int* height, int* rowbytes, uint8_t** mask, uint8_t** data);`\n\nGets various info about *bitmap* including its *width* and *height* and raw pixel data. The data is 1 bit per pixel packed format, in MSB order; in other words, the high bit of the first byte in `data` is the top left pixel of the image. If the bitmap has a mask, a pointer to its data is returned in *mask*, else NULL is returned."]
433 pub getBitmapData: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
434 width: *mut core::ffi::c_int,
435 height: *mut core::ffi::c_int,
436 rowbytes: *mut core::ffi::c_int,
437 mask: *mut *mut u8,
438 data: *mut *mut u8)>,
439 #[doc = "`void playdate->graphics->clearBitmap(LCDBitmap* bitmap, LCDColor bgcolor);`\n\nClears *bitmap*, filling with the given *bgcolor*."]
440 pub clearBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap, bgcolor: LCDColor)>,
441 #[doc = "`LCDBitmap* playdate->graphics->rotatedBitmap(LCDBitmap* bitmap, float rotation, float xscale, float yscale, int* allocedSize);`\n\nReturns a new, rotated and scaled LCDBitmap based on the given *bitmap*."]
442 pub rotatedBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
443 rotation: core::ffi::c_float,
444 xscale: core::ffi::c_float,
445 yscale: core::ffi::c_float,
446 allocedSize: *mut core::ffi::c_int)
447 -> *mut LCDBitmap>,
448 #[doc = "`LCDBitmapTable* playdate->graphics->newBitmapTable(int count, int width, int height);`\n\nAllocates and returns a new LCDBitmapTable that can hold *count* *width* by *height* LCDBitmaps."]
449 pub newBitmapTable: ::core::option::Option<unsafe extern "C" fn(count: core::ffi::c_int,
450 width: core::ffi::c_int,
451 height: core::ffi::c_int)
452 -> *mut LCDBitmapTable>,
453 #[doc = "`void playdate->graphics->freeBitmapTable(LCDBitmapTable* table);`\n\nFrees the given bitmap table. Note that this will invalidate any bitmaps returned by `getTableBitmap()`."]
454 pub freeBitmapTable: ::core::option::Option<unsafe extern "C" fn(table: *mut LCDBitmapTable)>,
455 #[doc = "`LCDBitmapTable* playdate->graphics->loadBitmapTable(const char* path, const char** outerr);`\n\nAllocates and returns a new LCDBitmap from the file at *path*. If there is no file at *path*, the function returns null."]
456 pub loadBitmapTable: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char,
457 outerr: *mut *const core::ffi::c_char)
458 -> *mut LCDBitmapTable>,
459 #[doc = "`void playdate->graphics->loadIntoBitmapTable(const char* path, LCDBitmapTable* table, const char** outerr);`\n\nLoads the imagetable at *path* into the previously allocated *table*."]
460 pub loadIntoBitmapTable: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char,
461 table: *mut LCDBitmapTable,
462 outerr: *mut *const core::ffi::c_char)>,
463 #[doc = "`LCDBitmap* playdate->graphics->getTableBitmap(LCDBitmapTable* table, int idx);`\n\nReturns the *idx* bitmap in *table*, If *idx* is out of bounds, the function returns NULL."]
464 pub getTableBitmap: ::core::option::Option<unsafe extern "C" fn(table: *mut LCDBitmapTable,
465 idx: core::ffi::c_int)
466 -> *mut LCDBitmap>,
467 #[doc = "`LCDFont* playdate->graphics->loadFont(const char* path, const char** outErr);`\n\nReturns the LCDFont object for the font file at *path*. In case of error, *outErr* points to a string describing the error. The returned font can be freed with [playdate→system→realloc(font, 0)](#f-system.realloc) when it is no longer in use."]
468 pub loadFont: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char,
469 outErr: *mut *const core::ffi::c_char)
470 -> *mut LCDFont>,
471 #[doc = "`LCDFontPage* playdate->graphics->getFontPage(LCDFont* font, uint32_t c);`\n\nReturns an LCDFontPage object for the given character code. Each LCDFontPage contains information for 256 characters; specifically, if `(c1 & ~0xff) == (c2 & ~0xff)`, then *c1* and *c2* belong to the same page and the same LCDFontPage can be used to fetch the character data for both instead of searching for the page twice."]
472 pub getFontPage: ::core::option::Option<unsafe extern "C" fn(font: *mut LCDFont, c: u32) -> *mut LCDFontPage>,
473 #[doc = "`LCDFontGlyph* playdate->graphics->getPageGlyph(LCDFontPage* page, uint32_t c, LCDBitmap** bitmap, int* advance);`\n\nReturns an LCDFontGlyph object for character *c* in LCDFontPage *page*, and optionally returns the glyph’s bitmap and advance value."]
474 pub getPageGlyph: ::core::option::Option<unsafe extern "C" fn(page: *mut LCDFontPage,
475 c: u32,
476 bitmap: *mut *mut LCDBitmap,
477 advance: *mut core::ffi::c_int)
478 -> *mut LCDFontGlyph>,
479 #[doc = "`int playdate->graphics->getGlyphKerning(LCDFontGlyph* glyph, uint32_t c1, uint32_t c2);`\n\nReturns the kerning adjustment between characters *c1* and *c2* as specified by the font."]
480 pub getGlyphKerning: ::core::option::Option<unsafe extern "C" fn(glyph: *mut LCDFontGlyph,
481 glyphcode: u32,
482 nextcode: u32)
483 -> core::ffi::c_int>,
484 #[doc = "`int playdate->graphics->getTextWidth(LCDFont* font, const void* text, size_t len, PDStringEncoding encoding, int tracking);`\n\nReturns the width of the given text in the given font. See the [note above](#f-graphics.drawText) about the `len` argument.\n\nPDStringEncoding\n\n```cpp\ntypedef enum\n{\n\tkASCIIEncoding,\n\tkUTF8Encoding,\n\tk16BitLEEncoding\n} PDStringEncoding;\n```"]
485 pub getTextWidth: ::core::option::Option<unsafe extern "C" fn(font: *mut LCDFont,
486 text: *const core::ffi::c_void,
487 len: usize,
488 encoding: PDStringEncoding,
489 tracking: core::ffi::c_int)
490 -> core::ffi::c_int>,
491 #[doc = "`uint8_t* playdate->graphics->getFrame(void);`\n\nReturns the current display frame buffer. Rows are 32-bit aligned, so the row stride is 52 bytes, with the extra 2 bytes per row ignored. Bytes are MSB-ordered; i.e., the pixel in column 0 is the 0x80 bit of the first byte of the row."]
492 pub getFrame: ::core::option::Option<unsafe extern "C" fn() -> *mut u8>,
493 #[doc = "`uint8_t* playdate->graphics->getDisplayFrame(void);`\n\nReturns the raw bits in the display buffer, the last completed frame."]
494 pub getDisplayFrame: ::core::option::Option<unsafe extern "C" fn() -> *mut u8>,
495 #[doc = "`LCDBitmap* playdate->graphics->getDebugBitmap(void);`\n\nOnly valid in the Simulator; function is NULL on device. Returns the debug framebuffer as a bitmap. White pixels drawn in the image are overlaid on the display in 50% transparent red."]
496 pub getDebugBitmap: ::core::option::Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
497 #[doc = "`LCDBitmap* playdate->graphics->copyFrameBufferBitmap(void);`\n\nReturns a copy the contents of the working frame buffer as a bitmap. The caller is responsible for freeing the returned bitmap with [playdate-\\>graphics-\\>freeBitmap()](#f-graphics.freeBitmap)."]
498 pub copyFrameBufferBitmap: ::core::option::Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
499 #[doc = "`void playdate->graphics->markUpdatedRows(int start, int end);`\n\nAfter updating pixels in the buffer returned by getFrame(), you must tell the graphics system which rows were updated. This function marks a contiguous range of rows as updated (e.g., markUpdatedRows(0,LCD\\_ROWS-1) tells the system to update the entire display). Both “start” and “end” are included in the range."]
500 pub markUpdatedRows:
501 ::core::option::Option<unsafe extern "C" fn(start: core::ffi::c_int, end: core::ffi::c_int)>,
502 #[doc = "`void playdate->graphics->display(void);`\n\nManually flushes the current frame buffer out to the display. This function is automatically called after each pass through the run loop, so there shouldn’t be any need to call it yourself."]
503 pub display: ::core::option::Option<unsafe extern "C" fn()>,
504 #[doc = "`void playdate->graphics->setColorToPattern(LCDColor* color, LCDBitmap* bitmap, int x, int y);`\n\nSets *color* to an 8 x 8 pattern using the given *bitmap*. *x*, *y* indicates the top left corner of the 8 x 8 pattern."]
505 pub setColorToPattern: ::core::option::Option<unsafe extern "C" fn(color: *mut LCDColor,
506 bitmap: *mut LCDBitmap,
507 x: core::ffi::c_int,
508 y: core::ffi::c_int)>,
509 #[doc = "`int playdate->graphics->checkMaskCollision(LCDBitmap* bitmap1, int x1, int y1, LCDBitmapFlip flip1, LCDBitmap* bitmap2, int x2, int y2, LCDBitmapFlip flip2, LCDRect rect);`\n\nReturns 1 if any of the opaque pixels in *bitmap1* when positioned at *x1*, *y1* with *flip1* overlap any of the opaque pixels in *bitmap2* at *x2*, *y2* with *flip2* within the non-empty *rect*, or 0 if no pixels overlap or if one or both fall completely outside of *rect*."]
510 pub checkMaskCollision: ::core::option::Option<unsafe extern "C" fn(bitmap1: *mut LCDBitmap,
511 x1: core::ffi::c_int,
512 y1: core::ffi::c_int,
513 flip1: LCDBitmapFlip,
514 bitmap2: *mut LCDBitmap,
515 x2: core::ffi::c_int,
516 y2: core::ffi::c_int,
517 flip2: LCDBitmapFlip,
518 rect: LCDRect)
519 -> core::ffi::c_int>,
520 #[doc = "`void playdate->graphics->setScreenClipRect(int x, int y, int width, int height);`\n\nSets the current clip rect in screen coordinates.\n\nEquivalent to [`playdate.graphics.setScreenClipRect()`](./Inside%20Playdate.html#f-graphics.setScreenClipRect) in the Lua API."]
521 pub setScreenClipRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int,
522 y: core::ffi::c_int,
523 width: core::ffi::c_int,
524 height: core::ffi::c_int)>,
525 #[doc = "`void playdate->graphics->fillPolygon(int nPoints, int* points, LCDColor color, LCDPolygonFillRule fillrule);`\n\nFills the polygon with vertices at the given coordinates (an array of 2\\*`nPoints` ints containing alternating x and y values) using the given color and fill, or winding, rule. See [https://en.wikipedia.org/wiki/Nonzero-rule](https://en.wikipedia.org/wiki/Nonzero-rule) for an explanation of the winding rule. An edge between the last vertex and the first is assumed.\n\nEquivalent to [`playdate.graphics.fillPolygon()`](./Inside%20Playdate.html#f-graphics.fillPolygon) in the Lua API."]
526 pub fillPolygon: ::core::option::Option<unsafe extern "C" fn(nPoints: core::ffi::c_int,
527 coords: *mut core::ffi::c_int,
528 color: LCDColor,
529 fillrule: LCDPolygonFillRule)>,
530 #[doc = "`uint8_t playdate->graphics->getFontHeight(LCDFont* font);`\n\nReturns the height of the given font."]
531 pub getFontHeight: ::core::option::Option<unsafe extern "C" fn(font: *mut LCDFont) -> u8>,
532 #[doc = "`LCDBitmap* playdate->graphics->getDisplayBufferBitmap(void);`\n\nReturns a bitmap containing the contents of the display buffer. The system owns this bitmap—\u{200b}do not free it!"]
533 pub getDisplayBufferBitmap: ::core::option::Option<unsafe extern "C" fn() -> *mut LCDBitmap>,
534 #[doc = "`void playdate->graphics->drawRotatedBitmap(LCDBitmap* bitmap, int x, int y, float degrees, float centerx, float centery, float xscale, float yscale);`\n\nDraws the *bitmap* scaled to *xscale* and *yscale* then rotated by *degrees* with its center as given by proportions *centerx* and *centery* at *x*, *y*; that is: if *centerx* and *centery* are both 0.5 the center of the image is at (*x*,*y*), if *centerx* and *centery* are both 0 the top left corner of the image (before rotation) is at (*x*,*y*), etc."]
535 pub drawRotatedBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
536 x: core::ffi::c_int,
537 y: core::ffi::c_int,
538 rotation: core::ffi::c_float,
539 centerx: core::ffi::c_float,
540 centery: core::ffi::c_float,
541 xscale: core::ffi::c_float,
542 yscale: core::ffi::c_float)>,
543 #[doc = "`void playdate->graphics->setTextLeading(int leading);`\n\nSets the leading adjustment (added to the leading specified in the font) to use when drawing text.\n\nEquivalent to [`playdate.graphics.font:setLeading()`](./Inside%20Playdate.html#m-graphics.font.setLeading) in the Lua API."]
544 pub setTextLeading: ::core::option::Option<unsafe extern "C" fn(lineHeightAdustment: core::ffi::c_int)>,
545 #[doc = "`int playdate->graphics->setBitmapMask(LCDBitmap* bitmap, LCDBitmap* mask);`\n\nSets a mask image for the given *bitmap*. The set mask must be the same size as the target bitmap."]
546 pub setBitmapMask: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
547 mask: *mut LCDBitmap)
548 -> core::ffi::c_int>,
549 #[doc = "`LCDBitmap* playdate->graphics->getBitmapMask(LCDBitmap* bitmap);`\n\nGets a mask image for the given *bitmap*, or returns NULL if the *bitmap* doesn’t have a mask layer. The returned image points to *bitmap*'s data, so drawing into the mask image affects the source bitmap directly. The caller takes ownership of the returned LCDBitmap and is responsible for freeing it when it’s no longer in use."]
550 pub getBitmapMask: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap) -> *mut LCDBitmap>,
551 #[doc = "`void playdate->graphics->setStencilImage(LCDBitmap* stencil, int tile);`\n\nSets the stencil used for drawing. If the *tile* flag is set the stencil image will be tiled. Tiled stencils must have width equal to a multiple of 32 pixels. To clear the stencil, call `playdate→graphics→setStencil(NULL);`.\n\nEquivalent to [`playdate.graphics.setStencilImage()`](./Inside%20Playdate.html#f-graphics.setStencilImage) in the Lua API."]
552 pub setStencilImage:
553 ::core::option::Option<unsafe extern "C" fn(stencil: *mut LCDBitmap, tile: core::ffi::c_int)>,
554 #[doc = "`LCDFont* playdate->graphics->makeFontFromData(LCDFontData* data, int wide);`\n\nReturns an LCDFont object wrapping the LCDFontData *data* comprising the contents (minus 16-byte header) of an uncompressed pft file. *wide* corresponds to the flag in the header indicating whether the font contains glyphs at codepoints above U+1FFFF."]
555 pub makeFontFromData: ::core::option::Option<unsafe extern "C" fn(data: *mut LCDFontData,
556 wide: core::ffi::c_int)
557 -> *mut LCDFont>,
558 #[doc = "`int playdate->graphics->getTextTracking(void);`\n\nGets the tracking used when drawing text.\n\nEquivalent to [`playdate.graphics.font:getTracking()`](./Inside%20Playdate.html#m-graphics.font.getTracking) in the Lua API."]
559 pub getTextTracking: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
560 #[doc = "`void playdate->graphics->setPixel(int x, int y, LCDColor color);`\n\nSets the pixel at *(x,y)* in the current drawing context (by default the screen) to the given *color*. Be aware that setting a pixel at a time is not very efficient: In our testing, more than around 20,000 calls in a tight loop will drop the frame rate below 30 fps."]
561 pub setPixel:
562 ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int, y: core::ffi::c_int, c: LCDColor)>,
563 #[doc = "`LCDSolidColor playdate->graphics->getBitmapPixel(LCDBitmap* bitmap, int x, int y);`\n\nGets the color of the pixel at *(x,y)* in the given *bitmap*. If the coordinate is outside the bounds of the bitmap, or if the bitmap has a mask and the pixel is marked transparent, the function returns `kColorClear`; otherwise the return value is `kColorWhite` or `kColorBlack`."]
564 pub getBitmapPixel: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap,
565 x: core::ffi::c_int,
566 y: core::ffi::c_int)
567 -> LCDSolidColor>,
568 #[doc = "`void playdate->graphics->getBitmapTableInfo(LCDBitmapTable* table, int* count, int* cellswide);`\n\nReturns the bitmap table’s image count in the *count* pointer (if not NULL) and number of cells across in the *cellswide* pointer (ditto)."]
569 pub getBitmapTableInfo: ::core::option::Option<unsafe extern "C" fn(table: *mut LCDBitmapTable,
570 count: *mut core::ffi::c_int,
571 width: *mut core::ffi::c_int)>,
572 #[doc = "`int playdate->graphics->drawTextInRect(const void* text, size_t len, PDStringEncoding encoding, int x, int y, int width, int height, PDTextWrappingMode wrap, PDTextAlignment align);`\n\nDraws the text in the given rectangle using the provided options. If no font has been set with [setFont](#f-graphics.setFont), the default system font Asheville Sans 14 Light is used. See the [above note](#f-graphics.drawText) about the `len` argument.\n\nThe *wrap* argument is one of\n\nPDTextWrappingMode\n\n```cpp\ntypedef enum\n{\n\tkWrapClip,\n\tkWrapCharacter,\n\tkWrapWord,\n} PDTextWrappingMode;\n```\n\nand *align* is one of\n\nPDTextAlignment\n\n```cpp\ntypedef enum\n{\n\tkAlignTextLeft,\n\tkAlignTextCenter,\n\tkAlignTextRight\n} PDTextAlignment;\n```"]
573 pub drawTextInRect: ::core::option::Option<unsafe extern "C" fn(text: *const core::ffi::c_void,
574 len: usize,
575 encoding: PDStringEncoding,
576 x: core::ffi::c_int,
577 y: core::ffi::c_int,
578 width: core::ffi::c_int,
579 height: core::ffi::c_int,
580 wrap: PDTextWrappingMode,
581 align: PDTextAlignment)>,
582}
583#[allow(clippy::unnecessary_operation, clippy::identity_op)]
584const _: () = {
585 ["Size of playdate_graphics"][::core::mem::size_of::<playdate_graphics>() - 256usize];
586 ["Alignment of playdate_graphics"][::core::mem::align_of::<playdate_graphics>() - 4usize];
587 ["Offset of field: playdate_graphics::video"][::core::mem::offset_of!(playdate_graphics, video) - 0usize];
588 ["Offset of field: playdate_graphics::clear"][::core::mem::offset_of!(playdate_graphics, clear) - 4usize];
589 ["Offset of field: playdate_graphics::setBackgroundColor"]
590 [::core::mem::offset_of!(playdate_graphics, setBackgroundColor) - 8usize];
591 ["Offset of field: playdate_graphics::setStencil"]
592 [::core::mem::offset_of!(playdate_graphics, setStencil) - 12usize];
593 ["Offset of field: playdate_graphics::setDrawMode"]
594 [::core::mem::offset_of!(playdate_graphics, setDrawMode) - 16usize];
595 ["Offset of field: playdate_graphics::setDrawOffset"]
596 [::core::mem::offset_of!(playdate_graphics, setDrawOffset) - 20usize];
597 ["Offset of field: playdate_graphics::setClipRect"]
598 [::core::mem::offset_of!(playdate_graphics, setClipRect) - 24usize];
599 ["Offset of field: playdate_graphics::clearClipRect"]
600 [::core::mem::offset_of!(playdate_graphics, clearClipRect) - 28usize];
601 ["Offset of field: playdate_graphics::setLineCapStyle"]
602 [::core::mem::offset_of!(playdate_graphics, setLineCapStyle) - 32usize];
603 ["Offset of field: playdate_graphics::setFont"][::core::mem::offset_of!(playdate_graphics, setFont) - 36usize];
604 ["Offset of field: playdate_graphics::setTextTracking"]
605 [::core::mem::offset_of!(playdate_graphics, setTextTracking) - 40usize];
606 ["Offset of field: playdate_graphics::pushContext"]
607 [::core::mem::offset_of!(playdate_graphics, pushContext) - 44usize];
608 ["Offset of field: playdate_graphics::popContext"]
609 [::core::mem::offset_of!(playdate_graphics, popContext) - 48usize];
610 ["Offset of field: playdate_graphics::drawBitmap"]
611 [::core::mem::offset_of!(playdate_graphics, drawBitmap) - 52usize];
612 ["Offset of field: playdate_graphics::tileBitmap"]
613 [::core::mem::offset_of!(playdate_graphics, tileBitmap) - 56usize];
614 ["Offset of field: playdate_graphics::drawLine"]
615 [::core::mem::offset_of!(playdate_graphics, drawLine) - 60usize];
616 ["Offset of field: playdate_graphics::fillTriangle"]
617 [::core::mem::offset_of!(playdate_graphics, fillTriangle) - 64usize];
618 ["Offset of field: playdate_graphics::drawRect"]
619 [::core::mem::offset_of!(playdate_graphics, drawRect) - 68usize];
620 ["Offset of field: playdate_graphics::fillRect"]
621 [::core::mem::offset_of!(playdate_graphics, fillRect) - 72usize];
622 ["Offset of field: playdate_graphics::drawEllipse"]
623 [::core::mem::offset_of!(playdate_graphics, drawEllipse) - 76usize];
624 ["Offset of field: playdate_graphics::fillEllipse"]
625 [::core::mem::offset_of!(playdate_graphics, fillEllipse) - 80usize];
626 ["Offset of field: playdate_graphics::drawScaledBitmap"]
627 [::core::mem::offset_of!(playdate_graphics, drawScaledBitmap) - 84usize];
628 ["Offset of field: playdate_graphics::drawText"]
629 [::core::mem::offset_of!(playdate_graphics, drawText) - 88usize];
630 ["Offset of field: playdate_graphics::newBitmap"]
631 [::core::mem::offset_of!(playdate_graphics, newBitmap) - 92usize];
632 ["Offset of field: playdate_graphics::freeBitmap"]
633 [::core::mem::offset_of!(playdate_graphics, freeBitmap) - 96usize];
634 ["Offset of field: playdate_graphics::loadBitmap"]
635 [::core::mem::offset_of!(playdate_graphics, loadBitmap) - 100usize];
636 ["Offset of field: playdate_graphics::copyBitmap"]
637 [::core::mem::offset_of!(playdate_graphics, copyBitmap) - 104usize];
638 ["Offset of field: playdate_graphics::loadIntoBitmap"]
639 [::core::mem::offset_of!(playdate_graphics, loadIntoBitmap) - 108usize];
640 ["Offset of field: playdate_graphics::getBitmapData"]
641 [::core::mem::offset_of!(playdate_graphics, getBitmapData) - 112usize];
642 ["Offset of field: playdate_graphics::clearBitmap"]
643 [::core::mem::offset_of!(playdate_graphics, clearBitmap) - 116usize];
644 ["Offset of field: playdate_graphics::rotatedBitmap"]
645 [::core::mem::offset_of!(playdate_graphics, rotatedBitmap) - 120usize];
646 ["Offset of field: playdate_graphics::newBitmapTable"]
647 [::core::mem::offset_of!(playdate_graphics, newBitmapTable) - 124usize];
648 ["Offset of field: playdate_graphics::freeBitmapTable"]
649 [::core::mem::offset_of!(playdate_graphics, freeBitmapTable) - 128usize];
650 ["Offset of field: playdate_graphics::loadBitmapTable"]
651 [::core::mem::offset_of!(playdate_graphics, loadBitmapTable) - 132usize];
652 ["Offset of field: playdate_graphics::loadIntoBitmapTable"]
653 [::core::mem::offset_of!(playdate_graphics, loadIntoBitmapTable) - 136usize];
654 ["Offset of field: playdate_graphics::getTableBitmap"]
655 [::core::mem::offset_of!(playdate_graphics, getTableBitmap) - 140usize];
656 ["Offset of field: playdate_graphics::loadFont"]
657 [::core::mem::offset_of!(playdate_graphics, loadFont) - 144usize];
658 ["Offset of field: playdate_graphics::getFontPage"]
659 [::core::mem::offset_of!(playdate_graphics, getFontPage) - 148usize];
660 ["Offset of field: playdate_graphics::getPageGlyph"]
661 [::core::mem::offset_of!(playdate_graphics, getPageGlyph) - 152usize];
662 ["Offset of field: playdate_graphics::getGlyphKerning"]
663 [::core::mem::offset_of!(playdate_graphics, getGlyphKerning) - 156usize];
664 ["Offset of field: playdate_graphics::getTextWidth"]
665 [::core::mem::offset_of!(playdate_graphics, getTextWidth) - 160usize];
666 ["Offset of field: playdate_graphics::getFrame"]
667 [::core::mem::offset_of!(playdate_graphics, getFrame) - 164usize];
668 ["Offset of field: playdate_graphics::getDisplayFrame"]
669 [::core::mem::offset_of!(playdate_graphics, getDisplayFrame) - 168usize];
670 ["Offset of field: playdate_graphics::getDebugBitmap"]
671 [::core::mem::offset_of!(playdate_graphics, getDebugBitmap) - 172usize];
672 ["Offset of field: playdate_graphics::copyFrameBufferBitmap"]
673 [::core::mem::offset_of!(playdate_graphics, copyFrameBufferBitmap) - 176usize];
674 ["Offset of field: playdate_graphics::markUpdatedRows"]
675 [::core::mem::offset_of!(playdate_graphics, markUpdatedRows) - 180usize];
676 ["Offset of field: playdate_graphics::display"]
677 [::core::mem::offset_of!(playdate_graphics, display) - 184usize];
678 ["Offset of field: playdate_graphics::setColorToPattern"]
679 [::core::mem::offset_of!(playdate_graphics, setColorToPattern) - 188usize];
680 ["Offset of field: playdate_graphics::checkMaskCollision"]
681 [::core::mem::offset_of!(playdate_graphics, checkMaskCollision) - 192usize];
682 ["Offset of field: playdate_graphics::setScreenClipRect"]
683 [::core::mem::offset_of!(playdate_graphics, setScreenClipRect) - 196usize];
684 ["Offset of field: playdate_graphics::fillPolygon"]
685 [::core::mem::offset_of!(playdate_graphics, fillPolygon) - 200usize];
686 ["Offset of field: playdate_graphics::getFontHeight"]
687 [::core::mem::offset_of!(playdate_graphics, getFontHeight) - 204usize];
688 ["Offset of field: playdate_graphics::getDisplayBufferBitmap"]
689 [::core::mem::offset_of!(playdate_graphics, getDisplayBufferBitmap) - 208usize];
690 ["Offset of field: playdate_graphics::drawRotatedBitmap"]
691 [::core::mem::offset_of!(playdate_graphics, drawRotatedBitmap) - 212usize];
692 ["Offset of field: playdate_graphics::setTextLeading"]
693 [::core::mem::offset_of!(playdate_graphics, setTextLeading) - 216usize];
694 ["Offset of field: playdate_graphics::setBitmapMask"]
695 [::core::mem::offset_of!(playdate_graphics, setBitmapMask) - 220usize];
696 ["Offset of field: playdate_graphics::getBitmapMask"]
697 [::core::mem::offset_of!(playdate_graphics, getBitmapMask) - 224usize];
698 ["Offset of field: playdate_graphics::setStencilImage"]
699 [::core::mem::offset_of!(playdate_graphics, setStencilImage) - 228usize];
700 ["Offset of field: playdate_graphics::makeFontFromData"]
701 [::core::mem::offset_of!(playdate_graphics, makeFontFromData) - 232usize];
702 ["Offset of field: playdate_graphics::getTextTracking"]
703 [::core::mem::offset_of!(playdate_graphics, getTextTracking) - 236usize];
704 ["Offset of field: playdate_graphics::setPixel"]
705 [::core::mem::offset_of!(playdate_graphics, setPixel) - 240usize];
706 ["Offset of field: playdate_graphics::getBitmapPixel"]
707 [::core::mem::offset_of!(playdate_graphics, getBitmapPixel) - 244usize];
708 ["Offset of field: playdate_graphics::getBitmapTableInfo"]
709 [::core::mem::offset_of!(playdate_graphics, getBitmapTableInfo) - 248usize];
710 ["Offset of field: playdate_graphics::drawTextInRect"]
711 [::core::mem::offset_of!(playdate_graphics, drawTextInRect) - 252usize];
712};
713impl Default for playdate_graphics {
714 fn default() -> Self {
715 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
716 unsafe {
717 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
718 s.assume_init()
719 }
720 }
721}
722pub type va_list = u32;
723impl PDButtons {
724 pub const kButtonLeft: PDButtons = PDButtons(1);
725}
726impl PDButtons {
727 pub const kButtonRight: PDButtons = PDButtons(2);
728}
729impl PDButtons {
730 pub const kButtonUp: PDButtons = PDButtons(4);
731}
732impl PDButtons {
733 pub const kButtonDown: PDButtons = PDButtons(8);
734}
735impl PDButtons {
736 pub const kButtonB: PDButtons = PDButtons(16);
737}
738impl PDButtons {
739 pub const kButtonA: PDButtons = PDButtons(32);
740}
741impl ::core::ops::BitOr<PDButtons> for PDButtons {
742 type Output = Self;
743 #[inline]
744 fn bitor(self, other: Self) -> Self { PDButtons(self.0 | other.0) }
745}
746impl ::core::ops::BitOrAssign for PDButtons {
747 #[inline]
748 fn bitor_assign(&mut self, rhs: PDButtons) { self.0 |= rhs.0; }
749}
750impl ::core::ops::BitAnd<PDButtons> for PDButtons {
751 type Output = Self;
752 #[inline]
753 fn bitand(self, other: Self) -> Self { PDButtons(self.0 & other.0) }
754}
755impl ::core::ops::BitAndAssign for PDButtons {
756 #[inline]
757 fn bitand_assign(&mut self, rhs: PDButtons) { self.0 &= rhs.0; }
758}
759#[repr(transparent)]
760#[must_use]
761#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
762pub struct PDButtons(pub u8);
763#[repr(u8)]
764#[must_use]
765#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
766pub enum PDLanguage {
767 kPDLanguageEnglish = 0,
768 kPDLanguageJapanese = 1,
769 kPDLanguageUnknown = 2,
770}
771#[repr(C)]
772#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
773#[must_use]
774pub struct PDDateTime {
775 pub year: u16,
776 pub month: u8,
777 pub day: u8,
778 pub weekday: u8,
779 pub hour: u8,
780 pub minute: u8,
781 pub second: u8,
782}
783#[allow(clippy::unnecessary_operation, clippy::identity_op)]
784const _: () = {
785 ["Size of PDDateTime"][::core::mem::size_of::<PDDateTime>() - 8usize];
786 ["Alignment of PDDateTime"][::core::mem::align_of::<PDDateTime>() - 2usize];
787 ["Offset of field: PDDateTime::year"][::core::mem::offset_of!(PDDateTime, year) - 0usize];
788 ["Offset of field: PDDateTime::month"][::core::mem::offset_of!(PDDateTime, month) - 2usize];
789 ["Offset of field: PDDateTime::day"][::core::mem::offset_of!(PDDateTime, day) - 3usize];
790 ["Offset of field: PDDateTime::weekday"][::core::mem::offset_of!(PDDateTime, weekday) - 4usize];
791 ["Offset of field: PDDateTime::hour"][::core::mem::offset_of!(PDDateTime, hour) - 5usize];
792 ["Offset of field: PDDateTime::minute"][::core::mem::offset_of!(PDDateTime, minute) - 6usize];
793 ["Offset of field: PDDateTime::second"][::core::mem::offset_of!(PDDateTime, second) - 7usize];
794};
795#[repr(C)]
796#[derive(Debug, Copy, Clone)]
797#[must_use]
798pub struct PDMenuItem {
799 _unused: [u8; 0],
800}
801#[repr(u16)]
802#[must_use]
803#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
804pub enum PDPeripherals {
805 kNone = 0,
806 kAccelerometer = 1,
807 kAllPeripherals = 65535,
808}
809pub type PDCallbackFunction =
810 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void) -> core::ffi::c_int>;
811pub type PDMenuItemCallbackFunction =
812 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void)>;
813pub type PDButtonCallbackFunction =
814 ::core::option::Option<unsafe extern "C" fn(button: PDButtons,
815 down: core::ffi::c_int,
816 when: u32,
817 userdata: *mut core::ffi::c_void)
818 -> core::ffi::c_int>;
819#[repr(C)]
820#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
821#[must_use]
822pub struct playdate_sys { # [doc = "`void* playdate->system->realloc(void* ptr, size_t size)`\n\nAllocates heap space if *ptr* is NULL, else reallocates the given pointer. If *size* is zero, frees the given pointer."] pub realloc : :: core :: option :: Option < unsafe extern "C" fn (ptr : * mut core :: ffi :: c_void , size : usize) -> * mut core :: ffi :: c_void > , # [doc = "`int playdate->system->formatString(char **outstring, const char *format, ...)`\n\nCreates a formatted string and returns it via the *outstring* argument. The arguments and return value match libc’s `asprintf()`: the format string is standard `printf()` style, the string returned in *outstring* should be freed by the caller when it’s no longer in use, and the return value is the length of the formatted string."] pub formatString : :: core :: option :: Option < unsafe extern "C" fn (ret : * mut * mut core :: ffi :: c_char , fmt : * const core :: ffi :: c_char , ...) -> core :: ffi :: c_int > , # [doc = "`void playdate->system->logToConsole(const char* format, ...)`\n\nCalls the log function.\n\nEquivalent to [`print()`](./Inside%20Playdate.html#f-print) in the Lua API."] pub logToConsole : :: core :: option :: Option < unsafe extern "C" fn (fmt : * const core :: ffi :: c_char , ...) > , # [doc = "`void playdate->system->error(const char* format, ...)`\n\nCalls the log function, outputting an error in red to the console, then pauses execution."] pub error : :: core :: option :: Option < unsafe extern "C" fn (fmt : * const core :: ffi :: c_char , ...) > , # [doc = "`PDLanguage playdate->system->getLanguage(void);`\n\nReturns the current language of the system."] pub getLanguage : :: core :: option :: Option < unsafe extern "C" fn () -> PDLanguage > , # [doc = "`unsigned int playdate->system->getCurrentTimeMilliseconds(void)`\n\nReturns the number of milliseconds since…\u{200b}some arbitrary point in time. This should present a consistent timebase while a game is running, but the counter will be disabled when the device is sleeping."] pub getCurrentTimeMilliseconds : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_uint > , # [doc = "`unsigned int playdate->system->getSecondsSinceEpoch(unsigned int *milliseconds)`\n\nReturns the number of seconds (and sets *milliseconds* if not NULL) elapsed since midnight (hour 0), January 1, 2000."] pub getSecondsSinceEpoch : :: core :: option :: Option < unsafe extern "C" fn (milliseconds : * mut core :: ffi :: c_uint) -> core :: ffi :: c_uint > , # [doc = "`void playdate->system->drawFPS(int x, int y)`\n\nCalculates the current frames per second and draws that value at *x, y*."] pub drawFPS : :: core :: option :: Option < unsafe extern "C" fn (x : core :: ffi :: c_int , y : core :: ffi :: c_int) > , # [doc = "`void playdate->system->setUpdateCallback(PDCallbackFunction* update, void* userdata)`\n\nPDCallbackFunction\n\n```cpp\nint PDCallbackFunction(void* userdata);\n```\n\nReplaces the default Lua run loop function with a custom update function. The update function should return a non-zero number to tell the system to update the display, or zero if update isn’t needed."] pub setUpdateCallback : :: core :: option :: Option < unsafe extern "C" fn (update : PDCallbackFunction , userdata : * mut core :: ffi :: c_void) > , # [doc = "`void playdate->system->getButtonState(PDButtons* current, PDButtons* pushed, PDButtons* released)`\n\nSets the value pointed to by *current* to a bitmask indicating which buttons are currently down. *pushed* and *released* reflect which buttons were pushed or released over the previous update cycle—at the nominal frame rate of 50 ms, fast button presses can be missed if you just poll the instantaneous state.\n\nPDButton\n\n```cpp\nkButtonLeft\nkButtonRight\nkButtonUp\nkButtonDown\nkButtonB\nkButtonA\n```"] pub getButtonState : :: core :: option :: Option < unsafe extern "C" fn (current : * mut PDButtons , pushed : * mut PDButtons , released : * mut PDButtons) > , # [doc = "`void playdate->system->setPeripheralsEnabled(PDPeripherals mask)`\n\nBy default, the accelerometer is disabled to save (a small amount of) power. To use a peripheral, it must first be enabled via this function. Accelerometer data is not available until the next update cycle after it’s enabled.\n\nPDPeripherals\n\n```cpp\nkNone\nkAccelerometer\n```"] pub setPeripheralsEnabled : :: core :: option :: Option < unsafe extern "C" fn (mask : PDPeripherals) > , # [doc = "`void playdate->system->getAccelerometer(float* outx, float* outy, float* outz)`\n\nReturns the last-read accelerometer data."] pub getAccelerometer : :: core :: option :: Option < unsafe extern "C" fn (outx : * mut core :: ffi :: c_float , outy : * mut core :: ffi :: c_float , outz : * mut core :: ffi :: c_float) > , # [doc = "`float playdate->system->getCrankChange(void)`\n\nReturns the angle change of the crank since the last time this function was called. Negative values are anti-clockwise."] pub getCrankChange : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_float > , # [doc = "`float playdate->system->getCrankAngle(void)`\n\nReturns the current position of the crank, in the range 0-360. Zero is pointing up, and the value increases as the crank moves clockwise, as viewed from the right side of the device."] pub getCrankAngle : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_float > , # [doc = "`int playdate->system->isCrankDocked(void)`\n\nReturns 1 or 0 indicating whether or not the crank is folded into the unit."] pub isCrankDocked : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_int > , # [doc = "`int playdate->system->setCrankSoundsDisabled(int disable)`\n\nThe function returns the previous value for this setting."] pub setCrankSoundsDisabled : :: core :: option :: Option < unsafe extern "C" fn (flag : core :: ffi :: c_int) -> core :: ffi :: c_int > , # [doc = "`int playdate->system->getFlipped()`\n\nReturns 1 if the global \"flipped\" system setting is set, otherwise 0."] pub getFlipped : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_int > , # [doc = "`void playdate->system->setAutoLockDisabled(int disable)`\n\nDisables or enables the 3 minute auto lock feature. When called, the timer is reset to 3 minutes."] pub setAutoLockDisabled : :: core :: option :: Option < unsafe extern "C" fn (disable : core :: ffi :: c_int) > , # [doc = "`void playdate->system->setMenuImage(LCDBitmap* bitmap, int xOffset);`\n\nA game can optionally provide an image to be displayed alongside the system menu. *bitmap* must be a 400x240 LCDBitmap. All important content should be in the left half of the image in an area 200 pixels wide, as the menu will obscure the rest. The right side of the image will be visible briefly as the menu animates in and out.\n\nOptionally, a non-zero *xoffset*, can be provided. This must be a number between 0 and 200 and will cause the menu image to animate to a position offset left by xoffset pixels as the menu is animated in.\n\nThis function could be called in response to the kEventPause *event* in your implementation of [eventHandler()](#_eventHandler)."] pub setMenuImage : :: core :: option :: Option < unsafe extern "C" fn (bitmap : * mut LCDBitmap , xOffset : core :: ffi :: c_int) > , # [doc = "`PDMenuItem* playdate->system->addMenuItem(const char* title, PDMenuItemCallbackFunction* callback, void* userdata)`\n\n*title* will be the title displayed by the menu item.\n\nAdds a new menu item to the System Menu. When invoked by the user, this menu item will:\n\n1. Invoke your *callback* function.\n\n2. Hide the System Menu.\n\n3. Unpause your game and call [eventHandler()](#_eventHandler) with the kEventResume *event*.\n\nYour game can then present an options interface to the player, or take other action, in whatever manner you choose.\n\nThe returned menu item is freed when removed from the menu; it does not need to be freed manually."] pub addMenuItem : :: core :: option :: Option < unsafe extern "C" fn (title : * const core :: ffi :: c_char , callback : PDMenuItemCallbackFunction , userdata : * mut core :: ffi :: c_void) -> * mut PDMenuItem > , # [doc = "`PDMenuItem* playdate->system->addCheckmarkMenuItem(const char* title, int value, PDMenuItemCallbackFunction* callback, void* userdata)`\n\nAdds a new menu item that can be checked or unchecked by the player.\n\n*title* will be the title displayed by the menu item.\n\n*value* should be 0 for unchecked, 1 for checked.\n\nIf this menu item is interacted with while the system menu is open, *callback* will be called when the menu is closed.\n\nThe returned menu item is freed when removed from the menu; it does not need to be freed manually."] pub addCheckmarkMenuItem : :: core :: option :: Option < unsafe extern "C" fn (title : * const core :: ffi :: c_char , value : core :: ffi :: c_int , callback : PDMenuItemCallbackFunction , userdata : * mut core :: ffi :: c_void) -> * mut PDMenuItem > , # [doc = "`PDMenuItem* playdate->system->addOptionsMenuItem(const char* title, const char** options, int optionsCount, PDMenuItemCallbackFunction* callback, void* userdata)`\n\nAdds a new menu item that allows the player to cycle through a set of options.\n\n*title* will be the title displayed by the menu item.\n\n*options* should be an array of strings representing the states this menu item can cycle through. Due to limited horizontal space, the option strings and title should be kept short for this type of menu item.\n\n*optionsCount* should be the number of items contained in *options*.\n\nIf this menu item is interacted with while the system menu is open, *callback* will be called when the menu is closed.\n\nThe returned menu item is freed when removed from the menu; it does not need to be freed manually."] pub addOptionsMenuItem : :: core :: option :: Option < unsafe extern "C" fn (title : * const core :: ffi :: c_char , optionTitles : * mut * const core :: ffi :: c_char , optionsCount : core :: ffi :: c_int , f : PDMenuItemCallbackFunction , userdata : * mut core :: ffi :: c_void) -> * mut PDMenuItem > , # [doc = "`void playdate->system->removeAllMenuItems()`\n\nRemoves all custom menu items from the system menu."] pub removeAllMenuItems : :: core :: option :: Option < unsafe extern "C" fn () > , # [doc = "`void playdate->system->removeMenuItem(PDMenuItem *menuItem)`\n\nRemoves the menu item from the system menu."] pub removeMenuItem : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem) > , # [doc = "`int playdate->system->getMenuItemValue(PDMenuItem *menuItem)`"] pub getMenuItemValue : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem) -> core :: ffi :: c_int > , # [doc = "`void playdate->system->setMenuItemValue(PDMenuItem *menuItem, int value)`\n\nGets or sets the integer value of the menu item.\n\nFor checkmark menu items, 1 means checked, 0 unchecked. For option menu items, the value indicates the array index of the currently selected option."] pub setMenuItemValue : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem , value : core :: ffi :: c_int) > , # [doc = "`const char* playdate->system->getMenuItemTitle(PDMenuItem *menuItem)`"] pub getMenuItemTitle : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem) -> * const core :: ffi :: c_char > , # [doc = "`void playdate->system->setMenuItemTitle(PDMenuItem *menuItem, const char* title)`\n\nGets or sets the display title of the menu item."] pub setMenuItemTitle : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem , title : * const core :: ffi :: c_char) > , # [doc = "`void* playdate->system->getMenuItemUserdata(PDMenuItem *menuItem)`"] pub getMenuItemUserdata : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem) -> * mut core :: ffi :: c_void > , # [doc = "`void playdate->system->setMenuItemUserdata(PDMenuItem *menuItem, void* userdata)`\n\nGets or sets the userdata value associated with this menu item."] pub setMenuItemUserdata : :: core :: option :: Option < unsafe extern "C" fn (menuItem : * mut PDMenuItem , ud : * mut core :: ffi :: c_void) > , # [doc = "`int playdate->system->getReduceFlashing()`\n\nReturns 1 if the global \"reduce flashing\" system setting is set, otherwise 0."] pub getReduceFlashing : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_int > , # [doc = "`float playdate->system->getElapsedTime()`\n\nReturns the number of seconds since `playdate.resetElapsedTime()` was called. The value is a floating-point number with microsecond accuracy."] pub getElapsedTime : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_float > , # [doc = "`void playdate->system->resetElapsedTime(void)`\n\nResets the high-resolution timer."] pub resetElapsedTime : :: core :: option :: Option < unsafe extern "C" fn () > , # [doc = "`float playdate->system->getBatteryPercentage()`\n\nReturns a value from 0-100 denoting the current level of battery charge. 0 = empty; 100 = full."] pub getBatteryPercentage : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_float > , # [doc = "`float playdate->system->getBatteryVoltage()`\n\nReturns the battery’s current voltage level."] pub getBatteryVoltage : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_float > , # [doc = "`int32_t playdate->system->getTimezoneOffset()`\n\nReturns the system timezone offset from GMT, in seconds."] pub getTimezoneOffset : :: core :: option :: Option < unsafe extern "C" fn () -> i32 > , # [doc = "`int playdate->system->shouldDisplay24HourTime()`\n\nReturns 1 if the user has set the 24-Hour Time preference in the Settings program."] pub shouldDisplay24HourTime : :: core :: option :: Option < unsafe extern "C" fn () -> core :: ffi :: c_int > , # [doc = "`void playdate->system->convertEpochToDateTime(uint32_t epoch, struct PDDateTime* datetime)`\n\nConverts the given epoch time to a PDDateTime."] pub convertEpochToDateTime : :: core :: option :: Option < unsafe extern "C" fn (epoch : u32 , datetime : * mut PDDateTime) > , # [doc = "`uint32_t playdate->system->convertDateTimeToEpoch(struct PDDateTime* datetime)`\n\nConverts the given PDDateTime to an epoch time."] pub convertDateTimeToEpoch : :: core :: option :: Option < unsafe extern "C" fn (datetime : * mut PDDateTime) -> u32 > , # [doc = "`float playdate->system->clearICache()`\n\nFlush the CPU instruction cache, on the very unlikely chance you’re modifying instruction code on the fly. (If you don’t know what I’m talking about, you don’t need this. :smile:)"] pub clearICache : :: core :: option :: Option < unsafe extern "C" fn () > , # [doc = "`void playdate->system->setButtonCallback(PDButtonCallbackFunction* cb, void* userdata, int queuesize)`\n\nAs an alternative to polling for button presses using `getButtonState()`, this function allows a callback function to be set. The function is called for each button up/down event (possibly multiple events on the same button) that occurred during the previous update cycle. At the default 30 FPS, a queue size of 5 should be adequate. At lower frame rates/longer frame times, the queue size should be extended until all button presses are caught. The function should return 0 on success or a non-zero value to signal an error.\n\nPDButtonCallbackFunction\n\n```cpp\ntypedef int PDButtonCallbackFunction(PDButtons button, int down, uint32_t when, void* userdata);\n```"] pub setButtonCallback : :: core :: option :: Option < unsafe extern "C" fn (cb : PDButtonCallbackFunction , buttonud : * mut core :: ffi :: c_void , queuesize : core :: ffi :: c_int) > , # [doc = "`void playdate->system->setSerialMessageCallback(void (*callback)(const char* data));`\n\nProvides a callback to receive messages sent to the device over the serial port using the `msg` command. If no device is connected, you can send these messages to a game in the simulator by entering `!msg <message>` in the Lua console."] pub setSerialMessageCallback : :: core :: option :: Option < unsafe extern "C" fn (callback : :: core :: option :: Option < unsafe extern "C" fn (data : * const core :: ffi :: c_char) >) > , # [doc = "`int playdate->system->vaFormatString(char **ret, const char *format, va_list args)`\n\nAllocates and formats a string using a variadic `va_list` argument, in the style of `vasprintf()`. The string returned via *ret* should be freed by the caller when it is no longer in use. The return value from the function is the length of the formatted string."] pub vaFormatString : :: core :: option :: Option < unsafe extern "C" fn (outstr : * mut * mut core :: ffi :: c_char , fmt : * const core :: ffi :: c_char , args : va_list) -> core :: ffi :: c_int > , # [doc = "`int playdate->system->parseString(const char *str, const char *format, ...)`\n\nLike libc `sscanf()`, parses a string according to a format string and places the values into pointers passed in after the format. The return value is the number of items matched."] pub parseString : :: core :: option :: Option < unsafe extern "C" fn (str_ : * const core :: ffi :: c_char , format : * const core :: ffi :: c_char , ...) -> core :: ffi :: c_int > , }
823#[allow(clippy::unnecessary_operation, clippy::identity_op)]
824const _: () = {
825 ["Size of playdate_sys"][::core::mem::size_of::<playdate_sys>() - 176usize];
826 ["Alignment of playdate_sys"][::core::mem::align_of::<playdate_sys>() - 4usize];
827 ["Offset of field: playdate_sys::realloc"][::core::mem::offset_of!(playdate_sys, realloc) - 0usize];
828 ["Offset of field: playdate_sys::formatString"][::core::mem::offset_of!(playdate_sys, formatString) - 4usize];
829 ["Offset of field: playdate_sys::logToConsole"][::core::mem::offset_of!(playdate_sys, logToConsole) - 8usize];
830 ["Offset of field: playdate_sys::error"][::core::mem::offset_of!(playdate_sys, error) - 12usize];
831 ["Offset of field: playdate_sys::getLanguage"][::core::mem::offset_of!(playdate_sys, getLanguage) - 16usize];
832 ["Offset of field: playdate_sys::getCurrentTimeMilliseconds"]
833 [::core::mem::offset_of!(playdate_sys, getCurrentTimeMilliseconds) - 20usize];
834 ["Offset of field: playdate_sys::getSecondsSinceEpoch"]
835 [::core::mem::offset_of!(playdate_sys, getSecondsSinceEpoch) - 24usize];
836 ["Offset of field: playdate_sys::drawFPS"][::core::mem::offset_of!(playdate_sys, drawFPS) - 28usize];
837 ["Offset of field: playdate_sys::setUpdateCallback"]
838 [::core::mem::offset_of!(playdate_sys, setUpdateCallback) - 32usize];
839 ["Offset of field: playdate_sys::getButtonState"]
840 [::core::mem::offset_of!(playdate_sys, getButtonState) - 36usize];
841 ["Offset of field: playdate_sys::setPeripheralsEnabled"]
842 [::core::mem::offset_of!(playdate_sys, setPeripheralsEnabled) - 40usize];
843 ["Offset of field: playdate_sys::getAccelerometer"]
844 [::core::mem::offset_of!(playdate_sys, getAccelerometer) - 44usize];
845 ["Offset of field: playdate_sys::getCrankChange"]
846 [::core::mem::offset_of!(playdate_sys, getCrankChange) - 48usize];
847 ["Offset of field: playdate_sys::getCrankAngle"]
848 [::core::mem::offset_of!(playdate_sys, getCrankAngle) - 52usize];
849 ["Offset of field: playdate_sys::isCrankDocked"]
850 [::core::mem::offset_of!(playdate_sys, isCrankDocked) - 56usize];
851 ["Offset of field: playdate_sys::setCrankSoundsDisabled"]
852 [::core::mem::offset_of!(playdate_sys, setCrankSoundsDisabled) - 60usize];
853 ["Offset of field: playdate_sys::getFlipped"][::core::mem::offset_of!(playdate_sys, getFlipped) - 64usize];
854 ["Offset of field: playdate_sys::setAutoLockDisabled"]
855 [::core::mem::offset_of!(playdate_sys, setAutoLockDisabled) - 68usize];
856 ["Offset of field: playdate_sys::setMenuImage"][::core::mem::offset_of!(playdate_sys, setMenuImage) - 72usize];
857 ["Offset of field: playdate_sys::addMenuItem"][::core::mem::offset_of!(playdate_sys, addMenuItem) - 76usize];
858 ["Offset of field: playdate_sys::addCheckmarkMenuItem"]
859 [::core::mem::offset_of!(playdate_sys, addCheckmarkMenuItem) - 80usize];
860 ["Offset of field: playdate_sys::addOptionsMenuItem"]
861 [::core::mem::offset_of!(playdate_sys, addOptionsMenuItem) - 84usize];
862 ["Offset of field: playdate_sys::removeAllMenuItems"]
863 [::core::mem::offset_of!(playdate_sys, removeAllMenuItems) - 88usize];
864 ["Offset of field: playdate_sys::removeMenuItem"]
865 [::core::mem::offset_of!(playdate_sys, removeMenuItem) - 92usize];
866 ["Offset of field: playdate_sys::getMenuItemValue"]
867 [::core::mem::offset_of!(playdate_sys, getMenuItemValue) - 96usize];
868 ["Offset of field: playdate_sys::setMenuItemValue"]
869 [::core::mem::offset_of!(playdate_sys, setMenuItemValue) - 100usize];
870 ["Offset of field: playdate_sys::getMenuItemTitle"]
871 [::core::mem::offset_of!(playdate_sys, getMenuItemTitle) - 104usize];
872 ["Offset of field: playdate_sys::setMenuItemTitle"]
873 [::core::mem::offset_of!(playdate_sys, setMenuItemTitle) - 108usize];
874 ["Offset of field: playdate_sys::getMenuItemUserdata"]
875 [::core::mem::offset_of!(playdate_sys, getMenuItemUserdata) - 112usize];
876 ["Offset of field: playdate_sys::setMenuItemUserdata"]
877 [::core::mem::offset_of!(playdate_sys, setMenuItemUserdata) - 116usize];
878 ["Offset of field: playdate_sys::getReduceFlashing"]
879 [::core::mem::offset_of!(playdate_sys, getReduceFlashing) - 120usize];
880 ["Offset of field: playdate_sys::getElapsedTime"]
881 [::core::mem::offset_of!(playdate_sys, getElapsedTime) - 124usize];
882 ["Offset of field: playdate_sys::resetElapsedTime"]
883 [::core::mem::offset_of!(playdate_sys, resetElapsedTime) - 128usize];
884 ["Offset of field: playdate_sys::getBatteryPercentage"]
885 [::core::mem::offset_of!(playdate_sys, getBatteryPercentage) - 132usize];
886 ["Offset of field: playdate_sys::getBatteryVoltage"]
887 [::core::mem::offset_of!(playdate_sys, getBatteryVoltage) - 136usize];
888 ["Offset of field: playdate_sys::getTimezoneOffset"]
889 [::core::mem::offset_of!(playdate_sys, getTimezoneOffset) - 140usize];
890 ["Offset of field: playdate_sys::shouldDisplay24HourTime"]
891 [::core::mem::offset_of!(playdate_sys, shouldDisplay24HourTime) - 144usize];
892 ["Offset of field: playdate_sys::convertEpochToDateTime"]
893 [::core::mem::offset_of!(playdate_sys, convertEpochToDateTime) - 148usize];
894 ["Offset of field: playdate_sys::convertDateTimeToEpoch"]
895 [::core::mem::offset_of!(playdate_sys, convertDateTimeToEpoch) - 152usize];
896 ["Offset of field: playdate_sys::clearICache"][::core::mem::offset_of!(playdate_sys, clearICache) - 156usize];
897 ["Offset of field: playdate_sys::setButtonCallback"]
898 [::core::mem::offset_of!(playdate_sys, setButtonCallback) - 160usize];
899 ["Offset of field: playdate_sys::setSerialMessageCallback"]
900 [::core::mem::offset_of!(playdate_sys, setSerialMessageCallback) - 164usize];
901 ["Offset of field: playdate_sys::vaFormatString"]
902 [::core::mem::offset_of!(playdate_sys, vaFormatString) - 168usize];
903 ["Offset of field: playdate_sys::parseString"][::core::mem::offset_of!(playdate_sys, parseString) - 172usize];
904};
905pub type lua_State = *mut core::ffi::c_void;
906pub type lua_CFunction = ::core::option::Option<unsafe extern "C" fn(L: *mut lua_State) -> core::ffi::c_int>;
907#[repr(C)]
908#[derive(Debug, Copy, Clone)]
909#[must_use]
910pub struct LuaUDObject {
911 _unused: [u8; 0],
912}
913#[repr(C)]
914#[derive(Debug, Copy, Clone)]
915#[must_use]
916pub struct LCDSprite {
917 _unused: [u8; 0],
918}
919#[repr(u8)]
920#[must_use]
921#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
922pub enum l_valtype {
923 kInt = 0,
924 kFloat = 1,
925 kStr = 2,
926}
927#[repr(C)]
928#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
929#[must_use]
930pub struct lua_reg {
931 pub name: *const core::ffi::c_char,
932 pub func: lua_CFunction,
933}
934#[allow(clippy::unnecessary_operation, clippy::identity_op)]
935const _: () = {
936 ["Size of lua_reg"][::core::mem::size_of::<lua_reg>() - 8usize];
937 ["Alignment of lua_reg"][::core::mem::align_of::<lua_reg>() - 4usize];
938 ["Offset of field: lua_reg::name"][::core::mem::offset_of!(lua_reg, name) - 0usize];
939 ["Offset of field: lua_reg::func"][::core::mem::offset_of!(lua_reg, func) - 4usize];
940};
941impl Default for lua_reg {
942 fn default() -> Self {
943 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
944 unsafe {
945 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
946 s.assume_init()
947 }
948 }
949}
950#[repr(u8)]
951#[must_use]
952#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
953pub enum LuaType {
954 kTypeNil = 0,
955 kTypeBool = 1,
956 kTypeInt = 2,
957 kTypeFloat = 3,
958 kTypeString = 4,
959 kTypeTable = 5,
960 kTypeFunction = 6,
961 kTypeThread = 7,
962 kTypeObject = 8,
963}
964#[repr(C)]
965#[derive(Copy, Clone)]
966#[must_use]
967pub struct lua_val {
968 pub name: *const core::ffi::c_char,
969 pub type_: l_valtype,
970 pub v: lua_val__bindgen_ty_1,
971}
972#[repr(C)]
973#[derive(Copy, Clone)]
974#[must_use]
975pub union lua_val__bindgen_ty_1 {
976 pub intval: core::ffi::c_uint,
977 pub floatval: core::ffi::c_float,
978 pub strval: *const core::ffi::c_char,
979}
980#[allow(clippy::unnecessary_operation, clippy::identity_op)]
981const _: () = {
982 ["Size of lua_val__bindgen_ty_1"][::core::mem::size_of::<lua_val__bindgen_ty_1>() - 4usize];
983 ["Alignment of lua_val__bindgen_ty_1"][::core::mem::align_of::<lua_val__bindgen_ty_1>() - 4usize];
984 ["Offset of field: lua_val__bindgen_ty_1::intval"]
985 [::core::mem::offset_of!(lua_val__bindgen_ty_1, intval) - 0usize];
986 ["Offset of field: lua_val__bindgen_ty_1::floatval"]
987 [::core::mem::offset_of!(lua_val__bindgen_ty_1, floatval) - 0usize];
988 ["Offset of field: lua_val__bindgen_ty_1::strval"]
989 [::core::mem::offset_of!(lua_val__bindgen_ty_1, strval) - 0usize];
990};
991impl Default for lua_val__bindgen_ty_1 {
992 fn default() -> Self {
993 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
994 unsafe {
995 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
996 s.assume_init()
997 }
998 }
999}
1000#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1001const _: () = {
1002 ["Size of lua_val"][::core::mem::size_of::<lua_val>() - 12usize];
1003 ["Alignment of lua_val"][::core::mem::align_of::<lua_val>() - 4usize];
1004 ["Offset of field: lua_val::name"][::core::mem::offset_of!(lua_val, name) - 0usize];
1005 ["Offset of field: lua_val::type_"][::core::mem::offset_of!(lua_val, type_) - 4usize];
1006 ["Offset of field: lua_val::v"][::core::mem::offset_of!(lua_val, v) - 8usize];
1007};
1008impl Default for lua_val {
1009 fn default() -> Self {
1010 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1011 unsafe {
1012 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1013 s.assume_init()
1014 }
1015 }
1016}
1017#[repr(C)]
1018#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1019#[must_use]
1020pub struct playdate_lua {
1021 #[doc = "`int playdate->lua->addFunction(lua_CFunction f, const char* name, const char** outErr);`\n\nAdds the Lua function *f* to the Lua runtime, with name *name*. (*name* can be a table path using dots, e.g. if name = “mycode.myDrawingFunction” adds the function “myDrawingFunction” to the global table “myCode”.) Returns 1 on success or 0 with an error message in *outErr*."]
1022 pub addFunction: ::core::option::Option<unsafe extern "C" fn(f: lua_CFunction,
1023 name: *const core::ffi::c_char,
1024 outErr: *mut *const core::ffi::c_char)
1025 -> core::ffi::c_int>,
1026 #[doc = "`int playdate->lua->registerClass(const char* name, const lua_reg* reg, const lua_val* vals, int isstatic, const char** outErr);`\n\nCreates a new \"class\" (i.e., a Lua metatable containing functions) with the given name and adds the given functions and constants to it. If the table is simply a list of functions that won’t be used as a metatable, *isstatic* should be set to 1 to create a plain table instead of a metatable. Please see `C_API/Examples/Array` for an example of how to use `registerClass` to create a Lua table-like object from C."]
1027 pub registerClass: ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char,
1028 reg: *const lua_reg,
1029 vals: *const lua_val,
1030 isstatic: core::ffi::c_int,
1031 outErr: *mut *const core::ffi::c_char)
1032 -> core::ffi::c_int>,
1033 #[doc = "`void playdate->lua->pushFunction(lua_CFunction f);`\n\nPushes a [lua\\_CFunction](#f-lua.cFunction) onto the stack."]
1034 pub pushFunction: ::core::option::Option<unsafe extern "C" fn(f: lua_CFunction)>,
1035 #[doc = "`int playdate->lua->indexMetatable(void);`\n\nIf a class includes an `__index` function, it should call this first to check if the indexed variable exists in the metatable. If the indexMetatable() call returns 1, it has located the variable and put it on the stack, and the `__index` function should return 1 to indicate a value was found. If indexMetatable() doesn’t find a value, the `__index` function can then do its custom getter magic."]
1036 pub indexMetatable: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1037 #[doc = "`void playdate->lua->stop(void);`\n\nStops the run loop."]
1038 pub stop: ::core::option::Option<unsafe extern "C" fn()>,
1039 #[doc = "`void playdate->lua->start(void);`\n\nStarts the run loop back up."]
1040 pub start: ::core::option::Option<unsafe extern "C" fn()>,
1041 #[doc = "`int playdate->lua->getArgCount(void);`\n\nReturns the number of arguments passed to the function."]
1042 pub getArgCount: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1043 #[doc = "`enum LuaType playdate->lua->getArgType(int pos, const char** outClass);`\n\nReturns the type of the variable at stack position *pos*. If the type is *kTypeObject* and *outClass* is non-NULL, it returns the name of the object’s metatable."]
1044 pub getArgType: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1045 outClass: *mut *const core::ffi::c_char)
1046 -> LuaType>,
1047 #[doc = "`int playdate->lua->argIsNil(int pos);`\n\nReturns 1 if the argument at the given position *pos* is nil."]
1048 pub argIsNil: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1049 #[doc = "`int playdate->lua->getArgBool(int pos);`\n\nReturns one if the argument at position *pos* is true, zero if not."]
1050 pub getArgBool: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1051 #[doc = "`int playdate->lua->getArgInt(int pos);`\n\nReturns the argument at position *pos* as an int."]
1052 pub getArgInt: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1053 #[doc = "`float playdate->lua->getArgFloat(int pos);`\n\nReturns the argument at position *pos* as a float."]
1054 pub getArgFloat: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_float>,
1055 #[doc = "`const char* playdate->lua->getArgString(int pos);`\n\nReturns the argument at position *pos* as a string."]
1056 pub getArgString:
1057 ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *const core::ffi::c_char>,
1058 #[doc = "`const char* playdate->lua->getArgBytes(int pos, size_t* outlen);`\n\nReturns the argument at position *pos* as a string and sets *outlen* to its length."]
1059 pub getArgBytes: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1060 outlen: *mut usize)
1061 -> *const core::ffi::c_char>,
1062 #[doc = "`void* playdate->lua->getArgObject(int pos, char* type, LuaUDObject** outud);`\n\nChecks the object type of the argument at position *pos* and returns a pointer to it if it’s the correct type. Optionally sets *outud* to a pointer to the opaque LuaUDObject for the given stack."]
1063 pub getArgObject: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1064 type_: *mut core::ffi::c_char,
1065 outud: *mut *mut LuaUDObject)
1066 -> *mut core::ffi::c_void>,
1067 #[doc = "`LCDBitmap* playdate->lua->getBitmap(int pos);`\n\nReturns the argument at position *pos* as an LCDBitmap."]
1068 pub getBitmap: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *mut LCDBitmap>,
1069 #[doc = "`LCDSprite* playdate->lua->getSprite(int pos);`\n\nReturns the argument at position *pos* as an LCDSprite."]
1070 pub getSprite: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *mut LCDSprite>,
1071 #[doc = "`void playdate->lua->pushNil(void);`\n\nPushes nil onto the stack."]
1072 pub pushNil: ::core::option::Option<unsafe extern "C" fn()>,
1073 #[doc = "`void playdate->lua->pushBool(int val);`\n\nPushes the int *val* onto the stack."]
1074 pub pushBool: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_int)>,
1075 #[doc = "`void playdate->lua->pushInt(int val);`\n\nPushes the int *val* onto the stack."]
1076 pub pushInt: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_int)>,
1077 #[doc = "`void playdate->lua->pushFloat(float val);`\n\nPushes the float *val* onto the stack."]
1078 pub pushFloat: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_float)>,
1079 #[doc = "`void playdate->lua->pushString(char* str);`\n\nPushes the string *str* onto the stack."]
1080 pub pushString: ::core::option::Option<unsafe extern "C" fn(str_: *const core::ffi::c_char)>,
1081 #[doc = "`void playdate->lua->pushBytes(char* str, size_t len);`\n\nLike *pushString()*, but pushes an arbitrary byte array to the stack, ignoring \\\\0 characters."]
1082 pub pushBytes: ::core::option::Option<unsafe extern "C" fn(str_: *const core::ffi::c_char, len: usize)>,
1083 #[doc = "`void playdate->lua->pushBitmap(LCDBitmap* bitmap);`\n\nPushes the LCDBitmap *bitmap* onto the stack."]
1084 pub pushBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap)>,
1085 #[doc = "`void playdate->lua->pushSprite(LCDSprite* sprite);`\n\nPushes the LCDSprite *sprite* onto the stack."]
1086 pub pushSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1087 #[doc = "`LuaUDObject* playdate->lua->pushObject(void* obj, char* type, int nValues);`\n\nPushes the given custom object *obj* onto the stack and returns a pointer to the opaque LuaUDObject. *type* must match the class name used in [playdate-\\>lua-\\>registerClass()](#f-lua.registerClass). *nValues* is the number of slots to allocate for Lua values (see [set/getObjectValue()](#f-lua.setObjectValue))."]
1088 pub pushObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut core::ffi::c_void,
1089 type_: *mut core::ffi::c_char,
1090 nValues: core::ffi::c_int)
1091 -> *mut LuaUDObject>,
1092 #[doc = "`LuaUDObject* playdate->lua->retainObject(LuaUDObject* obj);`\n\nRetains the opaque LuaUDObject *obj* and returns same."]
1093 pub retainObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject) -> *mut LuaUDObject>,
1094 #[doc = "`void playdate->lua->releaseObject(LuaUDObject* obj);`\n\nReleases the opaque LuaUDObject *obj*."]
1095 pub releaseObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject)>,
1096 #[doc = "`void playdate->lua->setUserValue(LuaUDObject* obj, int slot);`\n\nSets the value of object *obj*'s uservalue slot number *slot* (starting at 1, not zero) to the value at the top of the stack."]
1097 pub setUserValue: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: core::ffi::c_uint)>,
1098 #[doc = "`int playdate->lua->getUserValue(LuaUDObject* obj, int slot);`\n\nCopies the value at *obj*'s given uservalue *slot* to the top of the stack and returns its stack position."]
1099 pub getUserValue: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject,
1100 slot: core::ffi::c_uint)
1101 -> core::ffi::c_int>,
1102 pub callFunction_deprecated:
1103 ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char, nargs: core::ffi::c_int)>,
1104 #[doc = "`int playdate->lua->callFunction(const char* name, int nargs, const char** outerr);`\n\nCalls the Lua function *name* and and indicates that *nargs* number of arguments have already been pushed to the stack for the function to use. *name* can be a table path using dots, e.g. “playdate.apiVersion”. Returns 1 on success; on failure, returns 0 and puts an error message into the `outerr` pointer, if it’s set. Calling Lua from C is slow, so use sparingly."]
1105 pub callFunction: ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char,
1106 nargs: core::ffi::c_int,
1107 outerr: *mut *const core::ffi::c_char)
1108 -> core::ffi::c_int>,
1109}
1110#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1111const _: () = {
1112 ["Size of playdate_lua"][::core::mem::size_of::<playdate_lua>() - 128usize];
1113 ["Alignment of playdate_lua"][::core::mem::align_of::<playdate_lua>() - 4usize];
1114 ["Offset of field: playdate_lua::addFunction"][::core::mem::offset_of!(playdate_lua, addFunction) - 0usize];
1115 ["Offset of field: playdate_lua::registerClass"]
1116 [::core::mem::offset_of!(playdate_lua, registerClass) - 4usize];
1117 ["Offset of field: playdate_lua::pushFunction"][::core::mem::offset_of!(playdate_lua, pushFunction) - 8usize];
1118 ["Offset of field: playdate_lua::indexMetatable"]
1119 [::core::mem::offset_of!(playdate_lua, indexMetatable) - 12usize];
1120 ["Offset of field: playdate_lua::stop"][::core::mem::offset_of!(playdate_lua, stop) - 16usize];
1121 ["Offset of field: playdate_lua::start"][::core::mem::offset_of!(playdate_lua, start) - 20usize];
1122 ["Offset of field: playdate_lua::getArgCount"][::core::mem::offset_of!(playdate_lua, getArgCount) - 24usize];
1123 ["Offset of field: playdate_lua::getArgType"][::core::mem::offset_of!(playdate_lua, getArgType) - 28usize];
1124 ["Offset of field: playdate_lua::argIsNil"][::core::mem::offset_of!(playdate_lua, argIsNil) - 32usize];
1125 ["Offset of field: playdate_lua::getArgBool"][::core::mem::offset_of!(playdate_lua, getArgBool) - 36usize];
1126 ["Offset of field: playdate_lua::getArgInt"][::core::mem::offset_of!(playdate_lua, getArgInt) - 40usize];
1127 ["Offset of field: playdate_lua::getArgFloat"][::core::mem::offset_of!(playdate_lua, getArgFloat) - 44usize];
1128 ["Offset of field: playdate_lua::getArgString"][::core::mem::offset_of!(playdate_lua, getArgString) - 48usize];
1129 ["Offset of field: playdate_lua::getArgBytes"][::core::mem::offset_of!(playdate_lua, getArgBytes) - 52usize];
1130 ["Offset of field: playdate_lua::getArgObject"][::core::mem::offset_of!(playdate_lua, getArgObject) - 56usize];
1131 ["Offset of field: playdate_lua::getBitmap"][::core::mem::offset_of!(playdate_lua, getBitmap) - 60usize];
1132 ["Offset of field: playdate_lua::getSprite"][::core::mem::offset_of!(playdate_lua, getSprite) - 64usize];
1133 ["Offset of field: playdate_lua::pushNil"][::core::mem::offset_of!(playdate_lua, pushNil) - 68usize];
1134 ["Offset of field: playdate_lua::pushBool"][::core::mem::offset_of!(playdate_lua, pushBool) - 72usize];
1135 ["Offset of field: playdate_lua::pushInt"][::core::mem::offset_of!(playdate_lua, pushInt) - 76usize];
1136 ["Offset of field: playdate_lua::pushFloat"][::core::mem::offset_of!(playdate_lua, pushFloat) - 80usize];
1137 ["Offset of field: playdate_lua::pushString"][::core::mem::offset_of!(playdate_lua, pushString) - 84usize];
1138 ["Offset of field: playdate_lua::pushBytes"][::core::mem::offset_of!(playdate_lua, pushBytes) - 88usize];
1139 ["Offset of field: playdate_lua::pushBitmap"][::core::mem::offset_of!(playdate_lua, pushBitmap) - 92usize];
1140 ["Offset of field: playdate_lua::pushSprite"][::core::mem::offset_of!(playdate_lua, pushSprite) - 96usize];
1141 ["Offset of field: playdate_lua::pushObject"][::core::mem::offset_of!(playdate_lua, pushObject) - 100usize];
1142 ["Offset of field: playdate_lua::retainObject"]
1143 [::core::mem::offset_of!(playdate_lua, retainObject) - 104usize];
1144 ["Offset of field: playdate_lua::releaseObject"]
1145 [::core::mem::offset_of!(playdate_lua, releaseObject) - 108usize];
1146 ["Offset of field: playdate_lua::setUserValue"]
1147 [::core::mem::offset_of!(playdate_lua, setUserValue) - 112usize];
1148 ["Offset of field: playdate_lua::getUserValue"]
1149 [::core::mem::offset_of!(playdate_lua, getUserValue) - 116usize];
1150 ["Offset of field: playdate_lua::callFunction_deprecated"]
1151 [::core::mem::offset_of!(playdate_lua, callFunction_deprecated) - 120usize];
1152 ["Offset of field: playdate_lua::callFunction"]
1153 [::core::mem::offset_of!(playdate_lua, callFunction) - 124usize];
1154};
1155#[repr(u8)]
1156#[must_use]
1157#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1158pub enum json_value_type {
1159 kJSONNull = 0,
1160 kJSONTrue = 1,
1161 kJSONFalse = 2,
1162 kJSONInteger = 3,
1163 kJSONFloat = 4,
1164 kJSONString = 5,
1165 kJSONArray = 6,
1166 kJSONTable = 7,
1167}
1168#[repr(C)]
1169#[derive(Copy, Clone)]
1170#[must_use]
1171pub struct json_value {
1172 pub type_: core::ffi::c_char,
1173 pub data: json_value__bindgen_ty_1,
1174}
1175#[repr(C)]
1176#[derive(Copy, Clone)]
1177#[must_use]
1178pub union json_value__bindgen_ty_1 {
1179 pub intval: core::ffi::c_int,
1180 pub floatval: core::ffi::c_float,
1181 pub stringval: *mut core::ffi::c_char,
1182 pub arrayval: *mut core::ffi::c_void,
1183 pub tableval: *mut core::ffi::c_void,
1184}
1185#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1186const _: () = {
1187 ["Size of json_value__bindgen_ty_1"][::core::mem::size_of::<json_value__bindgen_ty_1>() - 4usize];
1188 ["Alignment of json_value__bindgen_ty_1"][::core::mem::align_of::<json_value__bindgen_ty_1>() - 4usize];
1189 ["Offset of field: json_value__bindgen_ty_1::intval"]
1190 [::core::mem::offset_of!(json_value__bindgen_ty_1, intval) - 0usize];
1191 ["Offset of field: json_value__bindgen_ty_1::floatval"]
1192 [::core::mem::offset_of!(json_value__bindgen_ty_1, floatval) - 0usize];
1193 ["Offset of field: json_value__bindgen_ty_1::stringval"]
1194 [::core::mem::offset_of!(json_value__bindgen_ty_1, stringval) - 0usize];
1195 ["Offset of field: json_value__bindgen_ty_1::arrayval"]
1196 [::core::mem::offset_of!(json_value__bindgen_ty_1, arrayval) - 0usize];
1197 ["Offset of field: json_value__bindgen_ty_1::tableval"]
1198 [::core::mem::offset_of!(json_value__bindgen_ty_1, tableval) - 0usize];
1199};
1200impl Default for json_value__bindgen_ty_1 {
1201 fn default() -> Self {
1202 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1203 unsafe {
1204 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1205 s.assume_init()
1206 }
1207 }
1208}
1209#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1210const _: () = {
1211 ["Size of json_value"][::core::mem::size_of::<json_value>() - 8usize];
1212 ["Alignment of json_value"][::core::mem::align_of::<json_value>() - 4usize];
1213 ["Offset of field: json_value::type_"][::core::mem::offset_of!(json_value, type_) - 0usize];
1214 ["Offset of field: json_value::data"][::core::mem::offset_of!(json_value, data) - 4usize];
1215};
1216impl Default for json_value {
1217 fn default() -> Self {
1218 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1219 unsafe {
1220 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1221 s.assume_init()
1222 }
1223 }
1224}
1225#[repr(C)]
1226#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1227#[must_use]
1228pub struct json_decoder {
1229 pub decodeError: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1230 error: *const core::ffi::c_char,
1231 linenum: core::ffi::c_int)>,
1232 pub willDecodeSublist: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1233 name: *const core::ffi::c_char,
1234 type_: json_value_type)>,
1235 pub shouldDecodeTableValueForKey: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1236 key: *const core::ffi::c_char)
1237 -> core::ffi::c_int>,
1238 pub didDecodeTableValue: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1239 key: *const core::ffi::c_char,
1240 value: json_value)>,
1241 pub shouldDecodeArrayValueAtIndex: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1242 pos: core::ffi::c_int)
1243 -> core::ffi::c_int>,
1244 pub didDecodeArrayValue: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1245 pos: core::ffi::c_int,
1246 value: json_value)>,
1247 pub didDecodeSublist: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1248 name: *const core::ffi::c_char,
1249 type_: json_value_type)
1250 -> *mut core::ffi::c_void>,
1251 pub userdata: *mut core::ffi::c_void,
1252 pub returnString: core::ffi::c_int,
1253 pub path: *const core::ffi::c_char,
1254}
1255#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1256const _: () = {
1257 ["Size of json_decoder"][::core::mem::size_of::<json_decoder>() - 40usize];
1258 ["Alignment of json_decoder"][::core::mem::align_of::<json_decoder>() - 4usize];
1259 ["Offset of field: json_decoder::decodeError"][::core::mem::offset_of!(json_decoder, decodeError) - 0usize];
1260 ["Offset of field: json_decoder::willDecodeSublist"]
1261 [::core::mem::offset_of!(json_decoder, willDecodeSublist) - 4usize];
1262 ["Offset of field: json_decoder::shouldDecodeTableValueForKey"]
1263 [::core::mem::offset_of!(json_decoder, shouldDecodeTableValueForKey) - 8usize];
1264 ["Offset of field: json_decoder::didDecodeTableValue"]
1265 [::core::mem::offset_of!(json_decoder, didDecodeTableValue) - 12usize];
1266 ["Offset of field: json_decoder::shouldDecodeArrayValueAtIndex"]
1267 [::core::mem::offset_of!(json_decoder, shouldDecodeArrayValueAtIndex) - 16usize];
1268 ["Offset of field: json_decoder::didDecodeArrayValue"]
1269 [::core::mem::offset_of!(json_decoder, didDecodeArrayValue) - 20usize];
1270 ["Offset of field: json_decoder::didDecodeSublist"]
1271 [::core::mem::offset_of!(json_decoder, didDecodeSublist) - 24usize];
1272 ["Offset of field: json_decoder::userdata"][::core::mem::offset_of!(json_decoder, userdata) - 28usize];
1273 ["Offset of field: json_decoder::returnString"][::core::mem::offset_of!(json_decoder, returnString) - 32usize];
1274 ["Offset of field: json_decoder::path"][::core::mem::offset_of!(json_decoder, path) - 36usize];
1275};
1276impl Default for json_decoder {
1277 fn default() -> Self {
1278 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1279 unsafe {
1280 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1281 s.assume_init()
1282 }
1283 }
1284}
1285pub type json_readFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
1286 buf: *mut u8,
1287 bufsize: core::ffi::c_int)
1288 -> core::ffi::c_int>;
1289#[repr(C)]
1290#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1291#[must_use]
1292pub struct json_reader {
1293 pub read: json_readFunc,
1294 pub userdata: *mut core::ffi::c_void,
1295}
1296#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1297const _: () = {
1298 ["Size of json_reader"][::core::mem::size_of::<json_reader>() - 8usize];
1299 ["Alignment of json_reader"][::core::mem::align_of::<json_reader>() - 4usize];
1300 ["Offset of field: json_reader::read"][::core::mem::offset_of!(json_reader, read) - 0usize];
1301 ["Offset of field: json_reader::userdata"][::core::mem::offset_of!(json_reader, userdata) - 4usize];
1302};
1303impl Default for json_reader {
1304 fn default() -> Self {
1305 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1306 unsafe {
1307 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1308 s.assume_init()
1309 }
1310 }
1311}
1312pub type json_writeFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
1313 str_: *const core::ffi::c_char,
1314 len: core::ffi::c_int)>;
1315#[repr(C)]
1316#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1317#[must_use]
1318pub struct json_encoder {
1319 pub writeStringFunc: json_writeFunc,
1320 pub userdata: *mut core::ffi::c_void,
1321 pub _bitfield_align_1: [u32; 0],
1322 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
1323 pub startArray: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1324 pub addArrayMember: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1325 pub endArray: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1326 pub startTable: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1327 pub addTableMember: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1328 name: *const core::ffi::c_char,
1329 len: core::ffi::c_int)>,
1330 pub endTable: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1331 pub writeNull: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1332 pub writeFalse: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1333 pub writeTrue: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1334 pub writeInt: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder, num: core::ffi::c_int)>,
1335 pub writeDouble:
1336 ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder, num: core::ffi::c_double)>,
1337 pub writeString: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1338 str_: *const core::ffi::c_char,
1339 len: core::ffi::c_int)>,
1340}
1341#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1342const _: () = {
1343 ["Size of json_encoder"][::core::mem::size_of::<json_encoder>() - 60usize];
1344 ["Alignment of json_encoder"][::core::mem::align_of::<json_encoder>() - 4usize];
1345 ["Offset of field: json_encoder::writeStringFunc"]
1346 [::core::mem::offset_of!(json_encoder, writeStringFunc) - 0usize];
1347 ["Offset of field: json_encoder::userdata"][::core::mem::offset_of!(json_encoder, userdata) - 4usize];
1348 ["Offset of field: json_encoder::startArray"][::core::mem::offset_of!(json_encoder, startArray) - 12usize];
1349 ["Offset of field: json_encoder::addArrayMember"]
1350 [::core::mem::offset_of!(json_encoder, addArrayMember) - 16usize];
1351 ["Offset of field: json_encoder::endArray"][::core::mem::offset_of!(json_encoder, endArray) - 20usize];
1352 ["Offset of field: json_encoder::startTable"][::core::mem::offset_of!(json_encoder, startTable) - 24usize];
1353 ["Offset of field: json_encoder::addTableMember"]
1354 [::core::mem::offset_of!(json_encoder, addTableMember) - 28usize];
1355 ["Offset of field: json_encoder::endTable"][::core::mem::offset_of!(json_encoder, endTable) - 32usize];
1356 ["Offset of field: json_encoder::writeNull"][::core::mem::offset_of!(json_encoder, writeNull) - 36usize];
1357 ["Offset of field: json_encoder::writeFalse"][::core::mem::offset_of!(json_encoder, writeFalse) - 40usize];
1358 ["Offset of field: json_encoder::writeTrue"][::core::mem::offset_of!(json_encoder, writeTrue) - 44usize];
1359 ["Offset of field: json_encoder::writeInt"][::core::mem::offset_of!(json_encoder, writeInt) - 48usize];
1360 ["Offset of field: json_encoder::writeDouble"][::core::mem::offset_of!(json_encoder, writeDouble) - 52usize];
1361 ["Offset of field: json_encoder::writeString"][::core::mem::offset_of!(json_encoder, writeString) - 56usize];
1362};
1363impl Default for json_encoder {
1364 fn default() -> Self {
1365 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1366 unsafe {
1367 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1368 s.assume_init()
1369 }
1370 }
1371}
1372impl json_encoder {
1373 #[inline]
1374 pub fn pretty(&self) -> core::ffi::c_int {
1375 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
1376 }
1377 #[inline]
1378 pub fn set_pretty(&mut self, val: core::ffi::c_int) {
1379 unsafe {
1380 let val: u32 = ::core::mem::transmute(val);
1381 self._bitfield_1.set(0usize, 1u8, val as u64)
1382 }
1383 }
1384 #[inline]
1385 pub unsafe fn pretty_raw(this: *const Self) -> core::ffi::c_int {
1386 unsafe {
1387 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 0usize , 1u8 ,) as u32)
1388 }
1389 }
1390 #[inline]
1391 pub unsafe fn set_pretty_raw(this: *mut Self, val: core::ffi::c_int) {
1392 unsafe {
1393 let val: u32 = ::core::mem::transmute(val);
1394 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1395 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1396 0usize,
1397 1u8,
1398 val as u64,
1399 )
1400 }
1401 }
1402 #[inline]
1403 pub fn startedTable(&self) -> core::ffi::c_int {
1404 unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
1405 }
1406 #[inline]
1407 pub fn set_startedTable(&mut self, val: core::ffi::c_int) {
1408 unsafe {
1409 let val: u32 = ::core::mem::transmute(val);
1410 self._bitfield_1.set(1usize, 1u8, val as u64)
1411 }
1412 }
1413 #[inline]
1414 pub unsafe fn startedTable_raw(this: *const Self) -> core::ffi::c_int {
1415 unsafe {
1416 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 1usize , 1u8 ,) as u32)
1417 }
1418 }
1419 #[inline]
1420 pub unsafe fn set_startedTable_raw(this: *mut Self, val: core::ffi::c_int) {
1421 unsafe {
1422 let val: u32 = ::core::mem::transmute(val);
1423 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1424 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1425 1usize,
1426 1u8,
1427 val as u64,
1428 )
1429 }
1430 }
1431 #[inline]
1432 pub fn startedArray(&self) -> core::ffi::c_int {
1433 unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) }
1434 }
1435 #[inline]
1436 pub fn set_startedArray(&mut self, val: core::ffi::c_int) {
1437 unsafe {
1438 let val: u32 = ::core::mem::transmute(val);
1439 self._bitfield_1.set(2usize, 1u8, val as u64)
1440 }
1441 }
1442 #[inline]
1443 pub unsafe fn startedArray_raw(this: *const Self) -> core::ffi::c_int {
1444 unsafe {
1445 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 2usize , 1u8 ,) as u32)
1446 }
1447 }
1448 #[inline]
1449 pub unsafe fn set_startedArray_raw(this: *mut Self, val: core::ffi::c_int) {
1450 unsafe {
1451 let val: u32 = ::core::mem::transmute(val);
1452 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1453 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1454 2usize,
1455 1u8,
1456 val as u64,
1457 )
1458 }
1459 }
1460 #[inline]
1461 pub fn depth(&self) -> core::ffi::c_int {
1462 unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 29u8) as u32) }
1463 }
1464 #[inline]
1465 pub fn set_depth(&mut self, val: core::ffi::c_int) {
1466 unsafe {
1467 let val: u32 = ::core::mem::transmute(val);
1468 self._bitfield_1.set(3usize, 29u8, val as u64)
1469 }
1470 }
1471 #[inline]
1472 pub unsafe fn depth_raw(this: *const Self) -> core::ffi::c_int {
1473 unsafe {
1474 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 3usize , 29u8 ,) as u32)
1475 }
1476 }
1477 #[inline]
1478 pub unsafe fn set_depth_raw(this: *mut Self, val: core::ffi::c_int) {
1479 unsafe {
1480 let val: u32 = ::core::mem::transmute(val);
1481 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1482 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1483 3usize,
1484 29u8,
1485 val as u64,
1486 )
1487 }
1488 }
1489 #[inline]
1490 pub fn new_bitfield_1(pretty: core::ffi::c_int,
1491 startedTable: core::ffi::c_int,
1492 startedArray: core::ffi::c_int,
1493 depth: core::ffi::c_int)
1494 -> __BindgenBitfieldUnit<[u8; 4usize]> {
1495 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
1496 __bindgen_bitfield_unit.set(0usize, 1u8, {
1497 let pretty: u32 = unsafe { ::core::mem::transmute(pretty) };
1498 pretty as u64
1499 });
1500 __bindgen_bitfield_unit.set(1usize, 1u8, {
1501 let startedTable: u32 = unsafe { ::core::mem::transmute(startedTable) };
1502 startedTable as u64
1503 });
1504 __bindgen_bitfield_unit.set(2usize, 1u8, {
1505 let startedArray: u32 = unsafe { ::core::mem::transmute(startedArray) };
1506 startedArray as u64
1507 });
1508 __bindgen_bitfield_unit.set(3usize, 29u8, {
1509 let depth: u32 = unsafe { ::core::mem::transmute(depth) };
1510 depth as u64
1511 });
1512 __bindgen_bitfield_unit
1513 }
1514}
1515#[repr(C)]
1516#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1517#[must_use]
1518pub struct playdate_json {
1519 #[doc = "`void playdate->json->initEncoder(json_encoder* encoder, writeFunc* write, void* userdata, int pretty);`\n\nPopulates the given json\\_encoder *encoder* with the functions necessary to encode arbitrary data into a JSON string. *userdata* is passed as the first argument of the given writeFunc *write*. When *pretty* is 1 the string is written with human-readable formatting."]
1520 pub initEncoder: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1521 write: json_writeFunc,
1522 userdata: *mut core::ffi::c_void,
1523 pretty: core::ffi::c_int)>,
1524 #[doc = "`int playdate->json->decode(struct json_decoder* decoder, json_reader reader, json_value* outval);`\n\nEquivalent to [`playdate.json.decode()`](./Inside%20Playdate.html#f-json.decode) in the Lua API."]
1525 pub decode: ::core::option::Option<unsafe extern "C" fn(functions: *mut json_decoder,
1526 reader: json_reader,
1527 outval: *mut json_value)
1528 -> core::ffi::c_int>,
1529 #[doc = "`int playdate->json->decodeString(struct json_decoder* decoder, const char* jsonString, json_value* outval);`\n\nDecodes a JSON file or string with the given *decoder*. An instance of json\\_decoder must implement *decodeError*. The remaining functions are optional although you’ll probably want to implement at least *didDecodeTableValue* and *didDecodeArrayValue*. The *outval* pointer, if set, contains the value retured from the top-level *didDecodeSublist* callback."]
1530 pub decodeString: ::core::option::Option<unsafe extern "C" fn(functions: *mut json_decoder,
1531 jsonString: *const core::ffi::c_char,
1532 outval: *mut json_value)
1533 -> core::ffi::c_int>,
1534}
1535#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1536const _: () = {
1537 ["Size of playdate_json"][::core::mem::size_of::<playdate_json>() - 12usize];
1538 ["Alignment of playdate_json"][::core::mem::align_of::<playdate_json>() - 4usize];
1539 ["Offset of field: playdate_json::initEncoder"][::core::mem::offset_of!(playdate_json, initEncoder) - 0usize];
1540 ["Offset of field: playdate_json::decode"][::core::mem::offset_of!(playdate_json, decode) - 4usize];
1541 ["Offset of field: playdate_json::decodeString"]
1542 [::core::mem::offset_of!(playdate_json, decodeString) - 8usize];
1543};
1544pub type SDFile = core::ffi::c_void;
1545impl FileOptions {
1546 pub const kFileRead: FileOptions = FileOptions(1);
1547}
1548impl FileOptions {
1549 pub const kFileReadData: FileOptions = FileOptions(2);
1550}
1551impl FileOptions {
1552 pub const kFileWrite: FileOptions = FileOptions(4);
1553}
1554impl FileOptions {
1555 pub const kFileAppend: FileOptions = FileOptions(8);
1556}
1557impl ::core::ops::BitOr<FileOptions> for FileOptions {
1558 type Output = Self;
1559 #[inline]
1560 fn bitor(self, other: Self) -> Self { FileOptions(self.0 | other.0) }
1561}
1562impl ::core::ops::BitOrAssign for FileOptions {
1563 #[inline]
1564 fn bitor_assign(&mut self, rhs: FileOptions) { self.0 |= rhs.0; }
1565}
1566impl ::core::ops::BitAnd<FileOptions> for FileOptions {
1567 type Output = Self;
1568 #[inline]
1569 fn bitand(self, other: Self) -> Self { FileOptions(self.0 & other.0) }
1570}
1571impl ::core::ops::BitAndAssign for FileOptions {
1572 #[inline]
1573 fn bitand_assign(&mut self, rhs: FileOptions) { self.0 &= rhs.0; }
1574}
1575#[repr(transparent)]
1576#[must_use]
1577#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1578pub struct FileOptions(pub u8);
1579#[repr(C)]
1580#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1581#[must_use]
1582pub struct FileStat {
1583 pub isdir: core::ffi::c_int,
1584 pub size: core::ffi::c_uint,
1585 pub m_year: core::ffi::c_int,
1586 pub m_month: core::ffi::c_int,
1587 pub m_day: core::ffi::c_int,
1588 pub m_hour: core::ffi::c_int,
1589 pub m_minute: core::ffi::c_int,
1590 pub m_second: core::ffi::c_int,
1591}
1592#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1593const _: () = {
1594 ["Size of FileStat"][::core::mem::size_of::<FileStat>() - 32usize];
1595 ["Alignment of FileStat"][::core::mem::align_of::<FileStat>() - 4usize];
1596 ["Offset of field: FileStat::isdir"][::core::mem::offset_of!(FileStat, isdir) - 0usize];
1597 ["Offset of field: FileStat::size"][::core::mem::offset_of!(FileStat, size) - 4usize];
1598 ["Offset of field: FileStat::m_year"][::core::mem::offset_of!(FileStat, m_year) - 8usize];
1599 ["Offset of field: FileStat::m_month"][::core::mem::offset_of!(FileStat, m_month) - 12usize];
1600 ["Offset of field: FileStat::m_day"][::core::mem::offset_of!(FileStat, m_day) - 16usize];
1601 ["Offset of field: FileStat::m_hour"][::core::mem::offset_of!(FileStat, m_hour) - 20usize];
1602 ["Offset of field: FileStat::m_minute"][::core::mem::offset_of!(FileStat, m_minute) - 24usize];
1603 ["Offset of field: FileStat::m_second"][::core::mem::offset_of!(FileStat, m_second) - 28usize];
1604};
1605#[repr(C)]
1606#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1607#[must_use]
1608pub struct playdate_file { # [doc = "`const char* playdate->file->geterr(void);`\n\nReturns human-readable text describing the most recent error (usually indicated by a -1 return from a filesystem function)."] pub geterr : :: core :: option :: Option < unsafe extern "C" fn () -> * const core :: ffi :: c_char > , # [doc = "`int playdate->file->listfiles(const char* path, void (*callback)(const char* filename, void* userdata), void* userdata, int showhidden);`\n\nCalls the given callback function for every file at *path*. Subfolders are indicated by a trailing slash '/' in *filename*. *listfiles()* does not recurse into subfolders. If *showhidden* is set, files beginning with a period will be included; otherwise, they are skipped. Returns 0 on success, -1 if no folder exists at *path* or it can’t be opened.\n\nEquivalent to [`playdate.file.listFiles()`](./Inside%20Playdate.html#f-file.listFiles) in the Lua API."] pub listfiles : :: core :: option :: Option < unsafe extern "C" fn (path : * const core :: ffi :: c_char , callback : :: core :: option :: Option < unsafe extern "C" fn (path : * const core :: ffi :: c_char , userdata : * mut core :: ffi :: c_void) > , userdata : * mut core :: ffi :: c_void , showhidden : core :: ffi :: c_int) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->stat(const char* path, FileStat* stat);`\n\nPopulates the FileStat *stat* with information about the file at *path*. Returns 0 on success, or -1 in case of error.\n\nFileStat\n\n```cpp\ntypedef struct\n{\n\tint isdir;\n\tunsigned int size;\n\tint m_year;\n\tint m_month;\n\tint m_day;\n\tint m_hour;\n\tint m_minute;\n\tint m_second;\n} FileStat;\n```"] pub stat : :: core :: option :: Option < unsafe extern "C" fn (path : * const core :: ffi :: c_char , stat : * mut FileStat) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->mkdir(const char* path);`\n\nCreates the given *path* in the Data/\\<gameid\\> folder. It does not create intermediate folders. Returns 0 on success, or -1 in case of error.\n\nEquivalent to [`playdate.file.mkdir()`](./Inside%20Playdate.html#f-file.mkdir) in the Lua API."] pub mkdir : :: core :: option :: Option < unsafe extern "C" fn (path : * const core :: ffi :: c_char) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->unlink(const char* path, int recursive);`\n\nDeletes the file at *path*. Returns 0 on success, or -1 in case of error. If recursive is 1 and the target path is a folder, this deletes everything inside the folder (including folders, folders inside those, and so on) as well as the folder itself."] pub unlink : :: core :: option :: Option < unsafe extern "C" fn (name : * const core :: ffi :: c_char , recursive : core :: ffi :: c_int) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->rename(const char* from, const char* to);`\n\nRenames the file at *from* to *to*. It will overwrite the file at *to* without confirmation. It does not create intermediate folders. Returns 0 on success, or -1 in case of error.\n\nEquivalent to [`playdate.file.rename()`](./Inside%20Playdate.html#f-file.rename) in the Lua API."] pub rename : :: core :: option :: Option < unsafe extern "C" fn (from : * const core :: ffi :: c_char , to : * const core :: ffi :: c_char) -> core :: ffi :: c_int > , # [doc = "`SDFile* playdate->file->open(const char* path, FileOptions mode);`\n\nOpens a handle for the file at *path*. The *kFileRead* mode opens a file in the game pdx, while *kFileReadData* searches the game’s data folder; to search the data folder first then fall back on the game pdx, use the bitwise combination *kFileRead|kFileReadData*.*kFileWrite* and *kFileAppend* always write to the data folder. The function returns NULL if a file at *path* cannot be opened, and [playdate-\\>file-\\>geterr()](#f-file.geterr) will describe the error. The filesystem has a limit of 64 simultaneous open files. The returned file handle should be [closed](#f-file.close), not freed, when it is no longer in use.\n\nFileOptions\n\n```cpp\ntypedef enum\n{\n\tkFileRead,\n\tkFileReadData,\n\tkFileWrite,\n\tkFileAppend\n} FileOptions;\n```\n\nEquivalent to [`playdate.file.open()`](./Inside%20Playdate.html#f-file.open) in the Lua API."] pub open : :: core :: option :: Option < unsafe extern "C" fn (name : * const core :: ffi :: c_char , mode : FileOptions) -> * mut SDFile > , # [doc = "`int playdate->file->close(SDFile* file);`\n\nCloses the given *file* handle. Returns 0 on success, or -1 in case of error.\n\nEquivalent to [`playdate.file.close()`](./Inside%20Playdate.html#f-file.close) in the Lua API."] pub close : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->read(SDFile* file, void* buf, unsigned int len);`\n\nReads up to *len* bytes from the *file* into the buffer *buf*. Returns the number of bytes read (0 indicating end of file), or -1 in case of error.\n\nEquivalent to [`playdate.file.file:read()`](./Inside%20Playdate.html#m-file.read) in the Lua API."] pub read : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile , buf : * mut core :: ffi :: c_void , len : core :: ffi :: c_uint) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->write(SDFile* file, const void* buf, unsigned int len);`\n\nWrites the buffer of bytes *buf* to the *file*. Returns the number of bytes written, or -1 in case of error.\n\nEquivalent to [`playdate.file.file:write()`](./Inside%20Playdate.html#m-file.write) in the Lua API."] pub write : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile , buf : * const core :: ffi :: c_void , len : core :: ffi :: c_uint) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->flush(SDFile* file);`\n\nFlushes the output buffer of *file* immediately. Returns the number of bytes written, or -1 in case of error.\n\nEquivalent to [`playdate.file.flush()`](./Inside%20Playdate.html#f-file.flush) in the Lua API."] pub flush : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->tell(SDFile* file);`\n\nReturns the current read/write offset in the given *file* handle, or -1 on error.\n\nEquivalent to [`playdate.file.file:tell()`](./Inside%20Playdate.html#m-file.tell) in the Lua API."] pub tell : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile) -> core :: ffi :: c_int > , # [doc = "`int playdate->file->seek(SDFile* file, int pos, int whence);`\n\nSets the read/write offset in the given *file* handle to *pos*, relative to the *whence* macro. SEEK\\_SET is relative to the beginning of the file, SEEK\\_CUR is relative to the current position of the file pointer, and SEEK\\_END is relative to the end of the file. Returns 0 on success, -1 on error.\n\nEquivalent to [`playdate.file.file:seek()`](./Inside%20Playdate.html#m-file.seek) in the Lua API."] pub seek : :: core :: option :: Option < unsafe extern "C" fn (file : * mut SDFile , pos : core :: ffi :: c_int , whence : core :: ffi :: c_int) -> core :: ffi :: c_int > , }
1609#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1610const _: () = {
1611 ["Size of playdate_file"][::core::mem::size_of::<playdate_file>() - 52usize];
1612 ["Alignment of playdate_file"][::core::mem::align_of::<playdate_file>() - 4usize];
1613 ["Offset of field: playdate_file::geterr"][::core::mem::offset_of!(playdate_file, geterr) - 0usize];
1614 ["Offset of field: playdate_file::listfiles"][::core::mem::offset_of!(playdate_file, listfiles) - 4usize];
1615 ["Offset of field: playdate_file::stat"][::core::mem::offset_of!(playdate_file, stat) - 8usize];
1616 ["Offset of field: playdate_file::mkdir"][::core::mem::offset_of!(playdate_file, mkdir) - 12usize];
1617 ["Offset of field: playdate_file::unlink"][::core::mem::offset_of!(playdate_file, unlink) - 16usize];
1618 ["Offset of field: playdate_file::rename"][::core::mem::offset_of!(playdate_file, rename) - 20usize];
1619 ["Offset of field: playdate_file::open"][::core::mem::offset_of!(playdate_file, open) - 24usize];
1620 ["Offset of field: playdate_file::close"][::core::mem::offset_of!(playdate_file, close) - 28usize];
1621 ["Offset of field: playdate_file::read"][::core::mem::offset_of!(playdate_file, read) - 32usize];
1622 ["Offset of field: playdate_file::write"][::core::mem::offset_of!(playdate_file, write) - 36usize];
1623 ["Offset of field: playdate_file::flush"][::core::mem::offset_of!(playdate_file, flush) - 40usize];
1624 ["Offset of field: playdate_file::tell"][::core::mem::offset_of!(playdate_file, tell) - 44usize];
1625 ["Offset of field: playdate_file::seek"][::core::mem::offset_of!(playdate_file, seek) - 48usize];
1626};
1627#[repr(u8)]
1628#[must_use]
1629#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1630pub enum SpriteCollisionResponseType {
1631 kCollisionTypeSlide = 0,
1632 kCollisionTypeFreeze = 1,
1633 kCollisionTypeOverlap = 2,
1634 kCollisionTypeBounce = 3,
1635}
1636#[repr(C)]
1637#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
1638#[must_use]
1639pub struct PDRect {
1640 pub x: core::ffi::c_float,
1641 pub y: core::ffi::c_float,
1642 pub width: core::ffi::c_float,
1643 pub height: core::ffi::c_float,
1644}
1645#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1646const _: () = {
1647 ["Size of PDRect"][::core::mem::size_of::<PDRect>() - 16usize];
1648 ["Alignment of PDRect"][::core::mem::align_of::<PDRect>() - 4usize];
1649 ["Offset of field: PDRect::x"][::core::mem::offset_of!(PDRect, x) - 0usize];
1650 ["Offset of field: PDRect::y"][::core::mem::offset_of!(PDRect, y) - 4usize];
1651 ["Offset of field: PDRect::width"][::core::mem::offset_of!(PDRect, width) - 8usize];
1652 ["Offset of field: PDRect::height"][::core::mem::offset_of!(PDRect, height) - 12usize];
1653};
1654#[repr(C)]
1655#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
1656#[must_use]
1657pub struct CollisionPoint {
1658 pub x: core::ffi::c_float,
1659 pub y: core::ffi::c_float,
1660}
1661#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1662const _: () = {
1663 ["Size of CollisionPoint"][::core::mem::size_of::<CollisionPoint>() - 8usize];
1664 ["Alignment of CollisionPoint"][::core::mem::align_of::<CollisionPoint>() - 4usize];
1665 ["Offset of field: CollisionPoint::x"][::core::mem::offset_of!(CollisionPoint, x) - 0usize];
1666 ["Offset of field: CollisionPoint::y"][::core::mem::offset_of!(CollisionPoint, y) - 4usize];
1667};
1668#[repr(C)]
1669#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1670#[must_use]
1671pub struct CollisionVector {
1672 pub x: core::ffi::c_int,
1673 pub y: core::ffi::c_int,
1674}
1675#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1676const _: () = {
1677 ["Size of CollisionVector"][::core::mem::size_of::<CollisionVector>() - 8usize];
1678 ["Alignment of CollisionVector"][::core::mem::align_of::<CollisionVector>() - 4usize];
1679 ["Offset of field: CollisionVector::x"][::core::mem::offset_of!(CollisionVector, x) - 0usize];
1680 ["Offset of field: CollisionVector::y"][::core::mem::offset_of!(CollisionVector, y) - 4usize];
1681};
1682#[repr(C)]
1683#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
1684#[must_use]
1685pub struct SpriteCollisionInfo {
1686 pub sprite: *mut LCDSprite,
1687 pub other: *mut LCDSprite,
1688 pub responseType: SpriteCollisionResponseType,
1689 pub overlaps: u8,
1690 pub ti: core::ffi::c_float,
1691 pub move_: CollisionPoint,
1692 pub normal: CollisionVector,
1693 pub touch: CollisionPoint,
1694 pub spriteRect: PDRect,
1695 pub otherRect: PDRect,
1696}
1697#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1698const _: () = {
1699 ["Size of SpriteCollisionInfo"][::core::mem::size_of::<SpriteCollisionInfo>() - 72usize];
1700 ["Alignment of SpriteCollisionInfo"][::core::mem::align_of::<SpriteCollisionInfo>() - 4usize];
1701 ["Offset of field: SpriteCollisionInfo::sprite"]
1702 [::core::mem::offset_of!(SpriteCollisionInfo, sprite) - 0usize];
1703 ["Offset of field: SpriteCollisionInfo::other"][::core::mem::offset_of!(SpriteCollisionInfo, other) - 4usize];
1704 ["Offset of field: SpriteCollisionInfo::responseType"]
1705 [::core::mem::offset_of!(SpriteCollisionInfo, responseType) - 8usize];
1706 ["Offset of field: SpriteCollisionInfo::overlaps"]
1707 [::core::mem::offset_of!(SpriteCollisionInfo, overlaps) - 9usize];
1708 ["Offset of field: SpriteCollisionInfo::ti"][::core::mem::offset_of!(SpriteCollisionInfo, ti) - 12usize];
1709 ["Offset of field: SpriteCollisionInfo::move_"][::core::mem::offset_of!(SpriteCollisionInfo, move_) - 16usize];
1710 ["Offset of field: SpriteCollisionInfo::normal"]
1711 [::core::mem::offset_of!(SpriteCollisionInfo, normal) - 24usize];
1712 ["Offset of field: SpriteCollisionInfo::touch"][::core::mem::offset_of!(SpriteCollisionInfo, touch) - 32usize];
1713 ["Offset of field: SpriteCollisionInfo::spriteRect"]
1714 [::core::mem::offset_of!(SpriteCollisionInfo, spriteRect) - 40usize];
1715 ["Offset of field: SpriteCollisionInfo::otherRect"]
1716 [::core::mem::offset_of!(SpriteCollisionInfo, otherRect) - 56usize];
1717};
1718impl Default for SpriteCollisionInfo {
1719 fn default() -> Self {
1720 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1721 unsafe {
1722 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1723 s.assume_init()
1724 }
1725 }
1726}
1727#[repr(C)]
1728#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
1729#[must_use]
1730pub struct SpriteQueryInfo {
1731 pub sprite: *mut LCDSprite,
1732 pub ti1: core::ffi::c_float,
1733 pub ti2: core::ffi::c_float,
1734 pub entryPoint: CollisionPoint,
1735 pub exitPoint: CollisionPoint,
1736}
1737#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1738const _: () = {
1739 ["Size of SpriteQueryInfo"][::core::mem::size_of::<SpriteQueryInfo>() - 28usize];
1740 ["Alignment of SpriteQueryInfo"][::core::mem::align_of::<SpriteQueryInfo>() - 4usize];
1741 ["Offset of field: SpriteQueryInfo::sprite"][::core::mem::offset_of!(SpriteQueryInfo, sprite) - 0usize];
1742 ["Offset of field: SpriteQueryInfo::ti1"][::core::mem::offset_of!(SpriteQueryInfo, ti1) - 4usize];
1743 ["Offset of field: SpriteQueryInfo::ti2"][::core::mem::offset_of!(SpriteQueryInfo, ti2) - 8usize];
1744 ["Offset of field: SpriteQueryInfo::entryPoint"]
1745 [::core::mem::offset_of!(SpriteQueryInfo, entryPoint) - 12usize];
1746 ["Offset of field: SpriteQueryInfo::exitPoint"][::core::mem::offset_of!(SpriteQueryInfo, exitPoint) - 20usize];
1747};
1748impl Default for SpriteQueryInfo {
1749 fn default() -> Self {
1750 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1751 unsafe {
1752 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1753 s.assume_init()
1754 }
1755 }
1756}
1757pub type LCDSpriteDrawFunction =
1758 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, bounds: PDRect, drawrect: PDRect)>;
1759pub type LCDSpriteUpdateFunction = ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>;
1760pub type LCDSpriteCollisionFilterProc =
1761 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1762 other: *mut LCDSprite)
1763 -> SpriteCollisionResponseType>;
1764#[repr(C)]
1765#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1766#[must_use]
1767pub struct playdate_sprite {
1768 #[doc = "`void playdate->sprite->setAlwaysRedraw(int flag);`\n\nWhen *flag* is set to 1, this causes all sprites to draw each frame, whether or not they have been marked dirty. This may speed up the performance of your game if the system’s dirty rect tracking is taking up too much time - for example if there are many sprites moving around on screen at once."]
1769 pub setAlwaysRedraw: ::core::option::Option<unsafe extern "C" fn(flag: core::ffi::c_int)>,
1770 #[doc = "`void playdate->sprite->addDirtyRect(LCDRect dirtyRect);`\n\nMarks the given *dirtyRect* (in screen coordinates) as needing a redraw. Graphics drawing functions now call this automatically, adding their drawn areas to the sprite’s dirty list, so there’s usually no need to call this manually."]
1771 pub addDirtyRect: ::core::option::Option<unsafe extern "C" fn(dirtyRect: LCDRect)>,
1772 #[doc = "`void playdate->sprite->drawSprites(void);`\n\nDraws every sprite in the display list."]
1773 pub drawSprites: ::core::option::Option<unsafe extern "C" fn()>,
1774 #[doc = "`void playdate->sprite->updateAndDrawSprites(void);`\n\nUpdates and draws every sprite in the display list."]
1775 pub updateAndDrawSprites: ::core::option::Option<unsafe extern "C" fn()>,
1776 #[doc = "`LCDSprite* playdate->sprite->newSprite(void);`\n\nAllocates and returns a new LCDSprite."]
1777 pub newSprite: ::core::option::Option<unsafe extern "C" fn() -> *mut LCDSprite>,
1778 pub freeSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1779 #[doc = "`LCDSprite* playdate->sprite->copy(LCDSprite *sprite);`\n\nAllocates and returns a copy of the given *sprite*."]
1780 pub copy: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut LCDSprite>,
1781 #[doc = "`void playdate->sprite->addSprite(LCDSprite *sprite);`\n\nAdds the given *sprite* to the display list, so that it is drawn in the current scene."]
1782 pub addSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1783 #[doc = "`void playdate->sprite->removeSprite(LCDSprite *sprite);`\n\nRemoves the given *sprite* from the display list."]
1784 pub removeSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1785 #[doc = "`void playdate->sprite->removeSprites(LCDSprite **sprites, int count);`\n\nRemoves the given *count* sized array of *sprites* from the display list."]
1786 pub removeSprites:
1787 ::core::option::Option<unsafe extern "C" fn(sprites: *mut *mut LCDSprite, count: core::ffi::c_int)>,
1788 #[doc = "`void playdate->sprite->removeAllSprites(void);`\n\nRemoves all sprites from the display list."]
1789 pub removeAllSprites: ::core::option::Option<unsafe extern "C" fn()>,
1790 #[doc = "`int playdate->sprite->getSpriteCount(void);`\n\nReturns the total number of sprites in the display list."]
1791 pub getSpriteCount: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1792 #[doc = "`void playdate->sprite->setBounds(LCDSprite *sprite, PDRect bounds);`\n\nSets the bounds of the given *sprite* with *bounds*."]
1793 pub setBounds: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, bounds: PDRect)>,
1794 #[doc = "`PDRect playdate->sprite->getBounds(LCDSprite *sprite);`\n\nReturns the bounds of the given *sprite* as an PDRect;"]
1795 pub getBounds: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> PDRect>,
1796 #[doc = "`void playdate->sprite->moveTo(LCDSprite *sprite, float x, float y);`\n\nMoves the given *sprite* to *x*, *y* and resets its bounds based on the bitmap dimensions and center."]
1797 pub moveTo: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1798 x: core::ffi::c_float,
1799 y: core::ffi::c_float)>,
1800 #[doc = "`void playdate->sprite->moveBy(LCDSprite *sprite, float dx, float dy);`\n\nMoves the given *sprite* to by offsetting its current position by *dx*, *dy*."]
1801 pub moveBy: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1802 dx: core::ffi::c_float,
1803 dy: core::ffi::c_float)>,
1804 #[doc = "`void playdate->sprite->setImage(LCDSprite *sprite, LCDBitmap *image, LCDBitmapFlip flip);`\n\nSets the given *sprite*'s image to the given *bitmap*."]
1805 pub setImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1806 image: *mut LCDBitmap,
1807 flip: LCDBitmapFlip)>,
1808 #[doc = "`LCDBitmap* playdate->sprite->getImage(LCDSprite *sprite);`\n\nReturns the LCDBitmap currently assigned to the given *sprite*."]
1809 pub getImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut LCDBitmap>,
1810 #[doc = "`void playdate->sprite->setSize(LCDSprite *s, float width, float height);`\n\nSets the size. The size is used to set the sprite’s bounds when calling moveTo()."]
1811 pub setSize: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1812 width: core::ffi::c_float,
1813 height: core::ffi::c_float)>,
1814 #[doc = "`void playdate->sprite->setZIndex(LCDSprite *sprite, int16_t zIndex);`\n\nSets the Z order of the given *sprite*. Higher Z sprites are drawn on top of those with lower Z order."]
1815 pub setZIndex: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, zIndex: i16)>,
1816 #[doc = "`int16_t playdate->sprite->getZIndex(LCDSprite *sprite);`\n\nReturns the Z index of the given *sprite*."]
1817 pub getZIndex: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> i16>,
1818 #[doc = "`void playdate->sprite->setDrawMode(LCDSprite *sprite, LCDBitmapDrawMode mode);`\n\nSets the mode for drawing the sprite’s bitmap."]
1819 pub setDrawMode: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, mode: LCDBitmapDrawMode)>,
1820 #[doc = "`void playdate->sprite->setImageFlip(LCDSprite *sprite, LCDBitmapFlip flip);`\n\nFlips the bitmap."]
1821 pub setImageFlip: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flip: LCDBitmapFlip)>,
1822 #[doc = "`LCDBitmapFlip playdate->sprite->getImageFlip(LCDSprite *sprite);`\n\nReturns the flip setting of the sprite’s bitmap."]
1823 pub getImageFlip: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> LCDBitmapFlip>,
1824 #[doc = "`void playdate->sprite->setStencil(LCDSprite *sprite, LCDBitmap* stencil);`\n\nSpecifies a stencil image to be set on the frame buffer before the sprite is drawn."]
1825 pub setStencil: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, stencil: *mut LCDBitmap)>,
1826 #[doc = "`void playdate->sprite->setClipRect(LCDSprite *sprite, LCDRect clipRect);`\n\nSets the clipping rectangle for sprite drawing."]
1827 pub setClipRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, clipRect: LCDRect)>,
1828 #[doc = "`void playdate->sprite->clearClipRect(LCDSprite *sprite);`\n\nClears the sprite’s clipping rectangle."]
1829 pub clearClipRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1830 #[doc = "`void playdate->sprite->setClipRectsInRange(LCDRect clipRect, int startZ, int endZ);`\n\nSets the clipping rectangle for *all* sprites with a Z index within *startZ* and *endZ* inclusive."]
1831 pub setClipRectsInRange: ::core::option::Option<unsafe extern "C" fn(clipRect: LCDRect,
1832 startZ: core::ffi::c_int,
1833 endZ: core::ffi::c_int)>,
1834 #[doc = "`void playdate->sprite->clearClipRectsInRange(int startZ, int endZ);`\n\nClears the clipping rectangle for *all* sprites with a Z index within *startZ* and *endZ* inclusive."]
1835 pub clearClipRectsInRange:
1836 ::core::option::Option<unsafe extern "C" fn(startZ: core::ffi::c_int, endZ: core::ffi::c_int)>,
1837 #[doc = "`void playdate->sprite->setUpdatesEnabled(LCDSprite *sprite, int flag);`\n\nSet the updatesEnabled flag of the given *sprite* (determines whether the sprite has its update function called). One is true, 0 is false."]
1838 pub setUpdatesEnabled:
1839 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1840 #[doc = "`int playdate->sprite->updatesEnabled(LCDSprite *sprite);`\n\nGet the updatesEnabled flag of the given *sprite*."]
1841 pub updatesEnabled: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1842 #[doc = "`void playdate->sprite->setCollisionsEnabled(LCDSprite *sprite, int flag);`\n\nSet the collisionsEnabled flag of the given *sprite* (along with the collideRect, this determines whether the sprite participates in collisions). One is true, 0 is false. Set to 1 by default."]
1843 pub setCollisionsEnabled:
1844 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1845 #[doc = "`int playdate->sprite->collisionsEnabled(LCDSprite *sprite);`\n\nGet the collisionsEnabled flag of the given *sprite*."]
1846 pub collisionsEnabled:
1847 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1848 #[doc = "`void playdate->sprite->setVisible(LCDSprite *sprite, int flag);`\n\nSet the visible flag of the given *sprite* (determines whether the sprite has its draw function called). One is true, 0 is false."]
1849 pub setVisible: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1850 #[doc = "`int playdate->sprite->isVisible(LCDSprite *sprite);`\n\nGet the visible flag of the given *sprite*."]
1851 pub isVisible: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1852 #[doc = "`void playdate->sprite->setOpaque(LCDSprite *sprite, int flag);`\n\nMarking a sprite opaque tells the sprite system that it doesn’t need to draw anything underneath the sprite, since it will be overdrawn anyway. If you set an image without a mask/alpha channel on the sprite, it automatically sets the opaque flag."]
1853 pub setOpaque: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1854 #[doc = "`void playdate->sprite->markDirty(LCDSprite *sprite);`\n\nForces the given *sprite* to redraw."]
1855 pub markDirty: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1856 #[doc = "`void playdate->sprite->setTag(LCDSprite *sprite, uint8_t tag);`\n\nSets the tag of the given *sprite*. This can be useful for identifying sprites or types of sprites when using the collision API."]
1857 pub setTag: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, tag: u8)>,
1858 #[doc = "`uint8_t playdate->sprite->getTag(LCDSprite *sprite);`\n\nReturns the tag of the given *sprite*."]
1859 pub getTag: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> u8>,
1860 #[doc = "`void playdate->sprite->setIgnoresDrawOffset(LCDSprite *sprite, int flag);`\n\nWhen *flag* is set to 1, the *sprite* will draw in screen coordinates, ignoring the currently-set drawOffset.\n\nThis only affects drawing, and should not be used on sprites being used for collisions, which will still happen in world-space."]
1861 pub setIgnoresDrawOffset:
1862 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1863 #[doc = "`void playdate->sprite->setUpdateFunction(LCDSprite *sprite, LCDSpriteUpdateFunction *func);`\n\nSets the update function for the given *sprite*."]
1864 pub setUpdateFunction:
1865 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteUpdateFunction)>,
1866 #[doc = "`void playdate->sprite->setDrawFunction(LCDSprite *sprite, LCDSpriteDrawFunction *func);`\n\nSets the draw function for the given *sprite*. Note that the callback is only called when the sprite is on screen and has a size specified via [playdate→sprite→setSize()](#f-sprite.setSize) or [playdate→sprite→setBounds()](#f-sprite.setBounds)."]
1867 pub setDrawFunction:
1868 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteDrawFunction)>,
1869 #[doc = "`void playdate->sprite->getPosition(LCDSprite *sprite, float *x, float *y);`\n\nSets *x* and *y* to the current position of *sprite*."]
1870 pub getPosition: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1871 x: *mut core::ffi::c_float,
1872 y: *mut core::ffi::c_float)>,
1873 #[doc = "`void playdate->sprite->resetCollisionWorld(void);`\n\nFrees and reallocates internal collision data, resetting everything to its default state."]
1874 pub resetCollisionWorld: ::core::option::Option<unsafe extern "C" fn()>,
1875 #[doc = "`void playdate->sprite->setCollideRect(LCDSprite *sprite, PDRect collideRect);`\n\nMarks the area of the given *sprite*, relative to its bounds, to be checked for collisions with other sprites' collide rects."]
1876 pub setCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, collideRect: PDRect)>,
1877 #[doc = "`PDRect playdate->sprite->getCollideRect(LCDSprite *sprite);`\n\nReturns the given *sprite*’s collide rect."]
1878 pub getCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> PDRect>,
1879 #[doc = "`void playdate->sprite->clearCollideRect(LCDSprite *sprite);`\n\nClears the given *sprite*’s collide rect."]
1880 pub clearCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1881 #[doc = "`void playdate->sprite->setCollisionResponseFunction(LCDSprite *sprite, LCDSpriteCollisionFilterProc *func);`\n\nSet a callback that returns a [SpriteCollisionResponseType](#_SpriteCollisionResponseType) for a collision between *sprite* and *other*.\n\nLCDSpriteCollisionFilterProc\n\n```cpp\ntypedef SpriteCollisionResponseType LCDSpriteCollisionFilterProc(LCDSprite* sprite, LCDSprite* other);\n```"]
1882 pub setCollisionResponseFunction:
1883 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteCollisionFilterProc)>,
1884 #[doc = "`SpriteCollisionInfo* playdate->sprite->checkCollisions(LCDSprite *sprite, float goalX, float goalY, float *actualX, float *actualY, int *len);`\n\nReturns the same values as [playdate-\\>sprite-\\>moveWithCollisions()](#f-sprite.moveWithCollisions) but does not actually move the sprite. The caller is responsible for freeing the returned array."]
1885 pub checkCollisions: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1886 goalX: core::ffi::c_float,
1887 goalY: core::ffi::c_float,
1888 actualX: *mut core::ffi::c_float,
1889 actualY: *mut core::ffi::c_float,
1890 len: *mut core::ffi::c_int)
1891 -> *mut SpriteCollisionInfo>,
1892 #[doc = "`SpriteCollisionInfo* playdate->sprite->moveWithCollisions(LCDSprite *sprite, float goalX, float goalY, float *actualX, float *actualY, int *len);`\n\nMoves the given *sprite* towards *goalX*, *goalY* taking collisions into account and returns an array of SpriteCollisionInfo. *len* is set to the size of the array and *actualX*, *actualY* are set to the sprite’s position after collisions. If no collisions occurred, this will be the same as *goalX*, *goalY*. The caller is responsible for freeing the returned array."]
1893 pub moveWithCollisions: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1894 goalX: core::ffi::c_float,
1895 goalY: core::ffi::c_float,
1896 actualX: *mut core::ffi::c_float,
1897 actualY: *mut core::ffi::c_float,
1898 len: *mut core::ffi::c_int)
1899 -> *mut SpriteCollisionInfo>,
1900 #[doc = "`LCDSprite** playdate->sprite->querySpritesAtPoint(float x, float y, int *len);`\n\nReturns an array of all sprites with collision rects containing the point at *x*, *y*. *len* is set to the size of the array. The caller is responsible for freeing the returned array."]
1901 pub querySpritesAtPoint: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_float,
1902 y: core::ffi::c_float,
1903 len: *mut core::ffi::c_int)
1904 -> *mut *mut LCDSprite>,
1905 #[doc = "`LCDSprite** playdate->sprite->querySpritesInRect(float x, float y, float width, float height, int *len);`\n\nReturns an array of all sprites with collision rects that intersect the *width* by *height* rect at *x*, *y*. *len* is set to the size of the array. The caller is responsible for freeing the returned array."]
1906 pub querySpritesInRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_float,
1907 y: core::ffi::c_float,
1908 width: core::ffi::c_float,
1909 height: core::ffi::c_float,
1910 len: *mut core::ffi::c_int)
1911 -> *mut *mut LCDSprite>,
1912 #[doc = "`LCDSprite** playdate->sprite->querySpritesAlongLine(float x1, float y1, float x2, float y2, int *len);`\n\nReturns an array of all sprites with collision rects that intersect the line connecting *x1*, *y1* and *x2*, *y2*. *len* is set to the size of the array. The caller is responsible for freeing the returned array."]
1913 pub querySpritesAlongLine: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_float,
1914 y1: core::ffi::c_float,
1915 x2: core::ffi::c_float,
1916 y2: core::ffi::c_float,
1917 len: *mut core::ffi::c_int)
1918 -> *mut *mut LCDSprite>,
1919 #[doc = "`SpriteQueryInfo* playdate->sprite->querySpriteInfoAlongLine(float x1, float y1, float x2, float y2, int *len);`\n\nReturns an array of SpriteQueryInfo for all sprites with collision rects that intersect the line connecting *x1*, *y1* and *x2*, *y2*. *len* is set to the size of the array. If you don’t need this information, use querySpritesAlongLine() as it will be faster. The caller is responsible for freeing the returned array."]
1920 pub querySpriteInfoAlongLine: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_float,
1921 y1: core::ffi::c_float,
1922 x2: core::ffi::c_float,
1923 y2: core::ffi::c_float,
1924 len: *mut core::ffi::c_int)
1925 -> *mut SpriteQueryInfo>,
1926 #[doc = "`LCDSprite** playdate->sprite->overlappingSprites(LCDSprite *sprite, int *len);`\n\nReturns an array of sprites that have collide rects that are currently overlapping the given *sprite*’s collide rect. *len* is set to the size of the array. The caller is responsible for freeing the returned array."]
1927 pub overlappingSprites: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1928 len: *mut core::ffi::c_int)
1929 -> *mut *mut LCDSprite>,
1930 #[doc = "`LCDSprite** playdate->sprite->allOverlappingSprites(int *len);`\n\nReturns an array of all sprites that have collide rects that are currently overlapping. Each consecutive pair of sprites is overlapping (eg. 0 & 1 overlap, 2 & 3 overlap, etc). *len* is set to the size of the array. The caller is responsible for freeing the returned array."]
1931 pub allOverlappingSprites:
1932 ::core::option::Option<unsafe extern "C" fn(len: *mut core::ffi::c_int) -> *mut *mut LCDSprite>,
1933 #[doc = "`void playdate->sprite->setStencilPattern(LCDSprite* sprite, uint8_t pattern[8]);`\n\nSets the sprite’s stencil to the given pattern."]
1934 pub setStencilPattern:
1935 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, pattern: *mut [u8; 8usize])>,
1936 #[doc = "`void playdate->sprite->clearStencil(LCDSprite *sprite);`\n\nClears the sprite’s stencil."]
1937 pub clearStencil: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1938 #[doc = "`void playdate->sprite->setUserdata(LCDSprite *sprite, void* userdata);`"]
1939 pub setUserdata:
1940 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, userdata: *mut core::ffi::c_void)>,
1941 #[doc = "`void* playdate->sprite->getUserdata(LCDSprite *sprite);`\n\nSets and gets the sprite’s userdata, an arbitrary pointer used for associating the sprite with other data."]
1942 pub getUserdata:
1943 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut core::ffi::c_void>,
1944 #[doc = "`void playdate->sprite->setStencilImage(LCDSprite *sprite, LCDBitmap* stencil, int tile);`\n\nSpecifies a stencil image to be set on the frame buffer before the sprite is drawn. If *tile* is set, the stencil will be tiled. Tiled stencils must have width evenly divisible by 32."]
1945 pub setStencilImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1946 stencil: *mut LCDBitmap,
1947 tile: core::ffi::c_int)>,
1948 #[doc = "`void playdate->sprite->setCenter(LCDSprite *sprite, float x, float y);`\n\nSets the sprite’s drawing center as a fraction (ranging from 0.0 to 1.0) of the height and width. Default is 0.5, 0.5 (the center of the sprite). This means that when you call [sprite→moveTo(sprite, x, y)](#f-sprite.moveTo), the center of your sprite will be positioned at *x*, *y*. If you want x and y to represent the upper left corner of your sprite, specify the center as 0, 0."]
1949 pub setCenter: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1950 x: core::ffi::c_float,
1951 y: core::ffi::c_float)>,
1952 #[doc = "`void playdate->sprite->getCenter(LCDSprite *sprite, float *outx, float *outy);`\n\nSets the values in `outx` and `outy` to the sprite’s drawing center as a fraction (ranging from 0.0 to 1.0) of the height and width."]
1953 pub getCenter: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1954 x: *mut core::ffi::c_float,
1955 y: *mut core::ffi::c_float)>,
1956}
1957#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1958const _: () = {
1959 ["Size of playdate_sprite"][::core::mem::size_of::<playdate_sprite>() - 252usize];
1960 ["Alignment of playdate_sprite"][::core::mem::align_of::<playdate_sprite>() - 4usize];
1961 ["Offset of field: playdate_sprite::setAlwaysRedraw"]
1962 [::core::mem::offset_of!(playdate_sprite, setAlwaysRedraw) - 0usize];
1963 ["Offset of field: playdate_sprite::addDirtyRect"]
1964 [::core::mem::offset_of!(playdate_sprite, addDirtyRect) - 4usize];
1965 ["Offset of field: playdate_sprite::drawSprites"]
1966 [::core::mem::offset_of!(playdate_sprite, drawSprites) - 8usize];
1967 ["Offset of field: playdate_sprite::updateAndDrawSprites"]
1968 [::core::mem::offset_of!(playdate_sprite, updateAndDrawSprites) - 12usize];
1969 ["Offset of field: playdate_sprite::newSprite"][::core::mem::offset_of!(playdate_sprite, newSprite) - 16usize];
1970 ["Offset of field: playdate_sprite::freeSprite"]
1971 [::core::mem::offset_of!(playdate_sprite, freeSprite) - 20usize];
1972 ["Offset of field: playdate_sprite::copy"][::core::mem::offset_of!(playdate_sprite, copy) - 24usize];
1973 ["Offset of field: playdate_sprite::addSprite"][::core::mem::offset_of!(playdate_sprite, addSprite) - 28usize];
1974 ["Offset of field: playdate_sprite::removeSprite"]
1975 [::core::mem::offset_of!(playdate_sprite, removeSprite) - 32usize];
1976 ["Offset of field: playdate_sprite::removeSprites"]
1977 [::core::mem::offset_of!(playdate_sprite, removeSprites) - 36usize];
1978 ["Offset of field: playdate_sprite::removeAllSprites"]
1979 [::core::mem::offset_of!(playdate_sprite, removeAllSprites) - 40usize];
1980 ["Offset of field: playdate_sprite::getSpriteCount"]
1981 [::core::mem::offset_of!(playdate_sprite, getSpriteCount) - 44usize];
1982 ["Offset of field: playdate_sprite::setBounds"][::core::mem::offset_of!(playdate_sprite, setBounds) - 48usize];
1983 ["Offset of field: playdate_sprite::getBounds"][::core::mem::offset_of!(playdate_sprite, getBounds) - 52usize];
1984 ["Offset of field: playdate_sprite::moveTo"][::core::mem::offset_of!(playdate_sprite, moveTo) - 56usize];
1985 ["Offset of field: playdate_sprite::moveBy"][::core::mem::offset_of!(playdate_sprite, moveBy) - 60usize];
1986 ["Offset of field: playdate_sprite::setImage"][::core::mem::offset_of!(playdate_sprite, setImage) - 64usize];
1987 ["Offset of field: playdate_sprite::getImage"][::core::mem::offset_of!(playdate_sprite, getImage) - 68usize];
1988 ["Offset of field: playdate_sprite::setSize"][::core::mem::offset_of!(playdate_sprite, setSize) - 72usize];
1989 ["Offset of field: playdate_sprite::setZIndex"][::core::mem::offset_of!(playdate_sprite, setZIndex) - 76usize];
1990 ["Offset of field: playdate_sprite::getZIndex"][::core::mem::offset_of!(playdate_sprite, getZIndex) - 80usize];
1991 ["Offset of field: playdate_sprite::setDrawMode"]
1992 [::core::mem::offset_of!(playdate_sprite, setDrawMode) - 84usize];
1993 ["Offset of field: playdate_sprite::setImageFlip"]
1994 [::core::mem::offset_of!(playdate_sprite, setImageFlip) - 88usize];
1995 ["Offset of field: playdate_sprite::getImageFlip"]
1996 [::core::mem::offset_of!(playdate_sprite, getImageFlip) - 92usize];
1997 ["Offset of field: playdate_sprite::setStencil"]
1998 [::core::mem::offset_of!(playdate_sprite, setStencil) - 96usize];
1999 ["Offset of field: playdate_sprite::setClipRect"]
2000 [::core::mem::offset_of!(playdate_sprite, setClipRect) - 100usize];
2001 ["Offset of field: playdate_sprite::clearClipRect"]
2002 [::core::mem::offset_of!(playdate_sprite, clearClipRect) - 104usize];
2003 ["Offset of field: playdate_sprite::setClipRectsInRange"]
2004 [::core::mem::offset_of!(playdate_sprite, setClipRectsInRange) - 108usize];
2005 ["Offset of field: playdate_sprite::clearClipRectsInRange"]
2006 [::core::mem::offset_of!(playdate_sprite, clearClipRectsInRange) - 112usize];
2007 ["Offset of field: playdate_sprite::setUpdatesEnabled"]
2008 [::core::mem::offset_of!(playdate_sprite, setUpdatesEnabled) - 116usize];
2009 ["Offset of field: playdate_sprite::updatesEnabled"]
2010 [::core::mem::offset_of!(playdate_sprite, updatesEnabled) - 120usize];
2011 ["Offset of field: playdate_sprite::setCollisionsEnabled"]
2012 [::core::mem::offset_of!(playdate_sprite, setCollisionsEnabled) - 124usize];
2013 ["Offset of field: playdate_sprite::collisionsEnabled"]
2014 [::core::mem::offset_of!(playdate_sprite, collisionsEnabled) - 128usize];
2015 ["Offset of field: playdate_sprite::setVisible"]
2016 [::core::mem::offset_of!(playdate_sprite, setVisible) - 132usize];
2017 ["Offset of field: playdate_sprite::isVisible"]
2018 [::core::mem::offset_of!(playdate_sprite, isVisible) - 136usize];
2019 ["Offset of field: playdate_sprite::setOpaque"]
2020 [::core::mem::offset_of!(playdate_sprite, setOpaque) - 140usize];
2021 ["Offset of field: playdate_sprite::markDirty"]
2022 [::core::mem::offset_of!(playdate_sprite, markDirty) - 144usize];
2023 ["Offset of field: playdate_sprite::setTag"][::core::mem::offset_of!(playdate_sprite, setTag) - 148usize];
2024 ["Offset of field: playdate_sprite::getTag"][::core::mem::offset_of!(playdate_sprite, getTag) - 152usize];
2025 ["Offset of field: playdate_sprite::setIgnoresDrawOffset"]
2026 [::core::mem::offset_of!(playdate_sprite, setIgnoresDrawOffset) - 156usize];
2027 ["Offset of field: playdate_sprite::setUpdateFunction"]
2028 [::core::mem::offset_of!(playdate_sprite, setUpdateFunction) - 160usize];
2029 ["Offset of field: playdate_sprite::setDrawFunction"]
2030 [::core::mem::offset_of!(playdate_sprite, setDrawFunction) - 164usize];
2031 ["Offset of field: playdate_sprite::getPosition"]
2032 [::core::mem::offset_of!(playdate_sprite, getPosition) - 168usize];
2033 ["Offset of field: playdate_sprite::resetCollisionWorld"]
2034 [::core::mem::offset_of!(playdate_sprite, resetCollisionWorld) - 172usize];
2035 ["Offset of field: playdate_sprite::setCollideRect"]
2036 [::core::mem::offset_of!(playdate_sprite, setCollideRect) - 176usize];
2037 ["Offset of field: playdate_sprite::getCollideRect"]
2038 [::core::mem::offset_of!(playdate_sprite, getCollideRect) - 180usize];
2039 ["Offset of field: playdate_sprite::clearCollideRect"]
2040 [::core::mem::offset_of!(playdate_sprite, clearCollideRect) - 184usize];
2041 ["Offset of field: playdate_sprite::setCollisionResponseFunction"]
2042 [::core::mem::offset_of!(playdate_sprite, setCollisionResponseFunction) - 188usize];
2043 ["Offset of field: playdate_sprite::checkCollisions"]
2044 [::core::mem::offset_of!(playdate_sprite, checkCollisions) - 192usize];
2045 ["Offset of field: playdate_sprite::moveWithCollisions"]
2046 [::core::mem::offset_of!(playdate_sprite, moveWithCollisions) - 196usize];
2047 ["Offset of field: playdate_sprite::querySpritesAtPoint"]
2048 [::core::mem::offset_of!(playdate_sprite, querySpritesAtPoint) - 200usize];
2049 ["Offset of field: playdate_sprite::querySpritesInRect"]
2050 [::core::mem::offset_of!(playdate_sprite, querySpritesInRect) - 204usize];
2051 ["Offset of field: playdate_sprite::querySpritesAlongLine"]
2052 [::core::mem::offset_of!(playdate_sprite, querySpritesAlongLine) - 208usize];
2053 ["Offset of field: playdate_sprite::querySpriteInfoAlongLine"]
2054 [::core::mem::offset_of!(playdate_sprite, querySpriteInfoAlongLine) - 212usize];
2055 ["Offset of field: playdate_sprite::overlappingSprites"]
2056 [::core::mem::offset_of!(playdate_sprite, overlappingSprites) - 216usize];
2057 ["Offset of field: playdate_sprite::allOverlappingSprites"]
2058 [::core::mem::offset_of!(playdate_sprite, allOverlappingSprites) - 220usize];
2059 ["Offset of field: playdate_sprite::setStencilPattern"]
2060 [::core::mem::offset_of!(playdate_sprite, setStencilPattern) - 224usize];
2061 ["Offset of field: playdate_sprite::clearStencil"]
2062 [::core::mem::offset_of!(playdate_sprite, clearStencil) - 228usize];
2063 ["Offset of field: playdate_sprite::setUserdata"]
2064 [::core::mem::offset_of!(playdate_sprite, setUserdata) - 232usize];
2065 ["Offset of field: playdate_sprite::getUserdata"]
2066 [::core::mem::offset_of!(playdate_sprite, getUserdata) - 236usize];
2067 ["Offset of field: playdate_sprite::setStencilImage"]
2068 [::core::mem::offset_of!(playdate_sprite, setStencilImage) - 240usize];
2069 ["Offset of field: playdate_sprite::setCenter"]
2070 [::core::mem::offset_of!(playdate_sprite, setCenter) - 244usize];
2071 ["Offset of field: playdate_sprite::getCenter"]
2072 [::core::mem::offset_of!(playdate_sprite, getCenter) - 248usize];
2073};
2074#[repr(u8)]
2075#[must_use]
2076#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2077pub enum SoundFormat {
2078 kSound8bitMono = 0,
2079 kSound8bitStereo = 1,
2080 kSound16bitMono = 2,
2081 kSound16bitStereo = 3,
2082 kSoundADPCMMono = 4,
2083 kSoundADPCMStereo = 5,
2084}
2085pub type MIDINote = core::ffi::c_float;
2086#[repr(C)]
2087#[derive(Debug, Copy, Clone)]
2088#[must_use]
2089pub struct SoundSource {
2090 _unused: [u8; 0],
2091}
2092pub type sndCallbackProc =
2093 ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource, userdata: *mut core::ffi::c_void)>;
2094#[repr(C)]
2095#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2096#[must_use]
2097pub struct playdate_sound_source {
2098 #[doc = "`void playdate->sound->source->setVolume(SoundSource* c, float lvol, float rvol)`\n\nSets the playback volume (0.0 - 1.0) for left and right channels of the source."]
2099 pub setVolume: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2100 lvol: core::ffi::c_float,
2101 rvol: core::ffi::c_float)>,
2102 #[doc = "`void playdate->sound->source->getVolume(SoundSource* c, float* outlvol, float* outrvol)`\n\nGets the playback volume (0.0 - 1.0) for left and right channels of the source."]
2103 pub getVolume: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2104 outl: *mut core::ffi::c_float,
2105 outr: *mut core::ffi::c_float)>,
2106 #[doc = "`int playdate->sound->source->isPlaying(SoundSource* c)`\n\nReturns 1 if the source is currently playing."]
2107 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource) -> core::ffi::c_int>,
2108 pub setFinishCallback: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2109 callback: sndCallbackProc,
2110 userdata: *mut core::ffi::c_void)>,
2111}
2112#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2113const _: () = {
2114 ["Size of playdate_sound_source"][::core::mem::size_of::<playdate_sound_source>() - 16usize];
2115 ["Alignment of playdate_sound_source"][::core::mem::align_of::<playdate_sound_source>() - 4usize];
2116 ["Offset of field: playdate_sound_source::setVolume"]
2117 [::core::mem::offset_of!(playdate_sound_source, setVolume) - 0usize];
2118 ["Offset of field: playdate_sound_source::getVolume"]
2119 [::core::mem::offset_of!(playdate_sound_source, getVolume) - 4usize];
2120 ["Offset of field: playdate_sound_source::isPlaying"]
2121 [::core::mem::offset_of!(playdate_sound_source, isPlaying) - 8usize];
2122 ["Offset of field: playdate_sound_source::setFinishCallback"]
2123 [::core::mem::offset_of!(playdate_sound_source, setFinishCallback) - 12usize];
2124};
2125#[repr(C)]
2126#[derive(Debug, Copy, Clone)]
2127#[must_use]
2128pub struct FilePlayer {
2129 _unused: [u8; 0],
2130}
2131#[repr(C)]
2132#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2133#[must_use]
2134pub struct playdate_sound_fileplayer { # [doc = "`FilePlayer* playdate->sound->fileplayer->newPlayer(void);`\n\nAllocates a new FilePlayer."] pub newPlayer : :: core :: option :: Option < unsafe extern "C" fn () -> * mut FilePlayer > , # [doc = "`void playdate->sound->fileplayer->freePlayer(FilePlayer* player);`\n\nFrees the given *player*."] pub freePlayer : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) > , # [doc = "`int playdate->sound->fileplayer->loadIntoPlayer(FilePlayer* player, const char* path);`\n\nPrepares *player* to stream the file at *path*. Returns 1 if the file exists, otherwise 0."] pub loadIntoPlayer : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , path : * const core :: ffi :: c_char) -> core :: ffi :: c_int > , # [doc = "`void playdate->sound->fileplayer->setBufferLength(FilePlayer* player, float bufferLen);`\n\nSets the buffer length of *player* to *bufferLen* seconds;"] pub setBufferLength : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , bufferLen : core :: ffi :: c_float) > , # [doc = "`int playdate->sound->fileplayer->play(FilePlayer* player, int repeat);`\n\nStarts playing the file *player*. If *repeat* is greater than one, it loops the given number of times. If zero, it loops endlessly until it is stopped with [playdate-\\>sound-\\>fileplayer-\\>stop()](#f-sound.fileplayer.stop). Returns 1 on success, 0 if buffer allocation failed."] pub play : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , repeat : core :: ffi :: c_int) -> core :: ffi :: c_int > , # [doc = "`int playdate->sound->fileplayer->isPlaying(FilePlayer* player);`\n\nReturns one if *player* is playing, zero if not."] pub isPlaying : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) -> core :: ffi :: c_int > , # [doc = "`void playdate->sound->fileplayer->pause(FilePlayer* player);`\n\nPauses the file *player*."] pub pause : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) > , # [doc = "`void playdate->sound->fileplayer->stop(FilePlayer* player);`\n\nStops playing the file."] pub stop : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) > , # [doc = "`void playdate->sound->fileplayer->setVolume(FilePlayer* player, float left, float right);`\n\nSets the playback volume for left and right channels of *player*."] pub setVolume : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , left : core :: ffi :: c_float , right : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->fileplayer->getVolume(FilePlayer* player, float* outleft, float* outright);`\n\nGets the left and right channel playback volume for *player*."] pub getVolume : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , left : * mut core :: ffi :: c_float , right : * mut core :: ffi :: c_float) > , # [doc = "`float playdate->sound->fileplayer->getLength(FilePlayer* player);`\n\nReturns the length, in seconds, of the file loaded into *player*."] pub getLength : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) -> core :: ffi :: c_float > , # [doc = "`void playdate->sound->fileplayer->setOffset(FilePlayer* player, float offset);`\n\nSets the current *offset* in seconds."] pub setOffset : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , offset : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->fileplayer->setRate(FilePlayer* player, float rate)`\n\nSets the playback *rate* for the *player*. 1.0 is normal speed, 0.5 is down an octave, 2.0 is up an octave, etc. Unlike sampleplayers, fileplayers can’t play in reverse (i.e., rate \\< 0)."] pub setRate : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , rate : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->fileplayer->setLoopRange(FilePlayer* player, float start, float end);`\n\nSets the *start* and *end* of the loop region for playback, in seconds. If *end* is omitted, the end of the file is used."] pub setLoopRange : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , start : core :: ffi :: c_float , end : core :: ffi :: c_float) > , # [doc = "`int playdate->sound->fileplayer->didUnderrun(FilePlayer* player);`\n\nReturns one if *player* has underrun, zero if not."] pub didUnderrun : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) -> core :: ffi :: c_int > , # [doc = "`void playdate->sound->fileplayer->setFinishCallback(FilePlayer* player, sndCallbackProc callback, void* userdata);`\n\nSets a function to be called when playback has completed. This is an alias for [playdate→sound→source→setFinishCallback()](#f-sound.source.setFinishCallback).\n\nsndCallbackProc\n\n```cpp\ntypedef void sndCallbackProc(SoundSource* c, void* userdata);\n```"] pub setFinishCallback : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , callback : sndCallbackProc , userdata : * mut core :: ffi :: c_void) > , pub setLoopCallback : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , callback : sndCallbackProc , userdata : * mut core :: ffi :: c_void) > , # [doc = "`float playdate->sound->fileplayer->getOffset(FilePlayer* player);`\n\nReturns the current offset in seconds for *player*."] pub getOffset : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) -> core :: ffi :: c_float > , # [doc = "`float playdate->sound->fileplayer->getRate(FilePlayer* player)`\n\nReturns the playback rate for *player*."] pub getRate : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer) -> core :: ffi :: c_float > , # [doc = "`void playdate->sound->fileplayer->setStopOnUnderrun(FilePlayer* player, int flag)`\n\nIf *flag* evaluates to true, the *player* will restart playback (after an audible stutter) as soon as data is available."] pub setStopOnUnderrun : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , flag : core :: ffi :: c_int) > , # [doc = "`void playdate->sound->fileplayer->fadeVolume(FilePlayer* player, float left, float right, int32_t len, sndCallbackProc finishCallback, void* userdata);`\n\nChanges the volume of the fileplayer to *left* and *right* over a length of *len* sample frames, then calls the provided callback (if set)."] pub fadeVolume : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , left : core :: ffi :: c_float , right : core :: ffi :: c_float , len : i32 , finishCallback : sndCallbackProc , userdata : * mut core :: ffi :: c_void) > , pub setMP3StreamSource : :: core :: option :: Option < unsafe extern "C" fn (player : * mut FilePlayer , dataSource : :: core :: option :: Option < unsafe extern "C" fn (data : * mut u8 , bytes : core :: ffi :: c_int , userdata : * mut core :: ffi :: c_void) -> core :: ffi :: c_int > , userdata : * mut core :: ffi :: c_void , bufferLen : core :: ffi :: c_float) > , }
2135#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2136const _: () = {
2137 ["Size of playdate_sound_fileplayer"][::core::mem::size_of::<playdate_sound_fileplayer>() - 88usize];
2138 ["Alignment of playdate_sound_fileplayer"][::core::mem::align_of::<playdate_sound_fileplayer>() - 4usize];
2139 ["Offset of field: playdate_sound_fileplayer::newPlayer"]
2140 [::core::mem::offset_of!(playdate_sound_fileplayer, newPlayer) - 0usize];
2141 ["Offset of field: playdate_sound_fileplayer::freePlayer"]
2142 [::core::mem::offset_of!(playdate_sound_fileplayer, freePlayer) - 4usize];
2143 ["Offset of field: playdate_sound_fileplayer::loadIntoPlayer"]
2144 [::core::mem::offset_of!(playdate_sound_fileplayer, loadIntoPlayer) - 8usize];
2145 ["Offset of field: playdate_sound_fileplayer::setBufferLength"]
2146 [::core::mem::offset_of!(playdate_sound_fileplayer, setBufferLength) - 12usize];
2147 ["Offset of field: playdate_sound_fileplayer::play"]
2148 [::core::mem::offset_of!(playdate_sound_fileplayer, play) - 16usize];
2149 ["Offset of field: playdate_sound_fileplayer::isPlaying"]
2150 [::core::mem::offset_of!(playdate_sound_fileplayer, isPlaying) - 20usize];
2151 ["Offset of field: playdate_sound_fileplayer::pause"]
2152 [::core::mem::offset_of!(playdate_sound_fileplayer, pause) - 24usize];
2153 ["Offset of field: playdate_sound_fileplayer::stop"]
2154 [::core::mem::offset_of!(playdate_sound_fileplayer, stop) - 28usize];
2155 ["Offset of field: playdate_sound_fileplayer::setVolume"]
2156 [::core::mem::offset_of!(playdate_sound_fileplayer, setVolume) - 32usize];
2157 ["Offset of field: playdate_sound_fileplayer::getVolume"]
2158 [::core::mem::offset_of!(playdate_sound_fileplayer, getVolume) - 36usize];
2159 ["Offset of field: playdate_sound_fileplayer::getLength"]
2160 [::core::mem::offset_of!(playdate_sound_fileplayer, getLength) - 40usize];
2161 ["Offset of field: playdate_sound_fileplayer::setOffset"]
2162 [::core::mem::offset_of!(playdate_sound_fileplayer, setOffset) - 44usize];
2163 ["Offset of field: playdate_sound_fileplayer::setRate"]
2164 [::core::mem::offset_of!(playdate_sound_fileplayer, setRate) - 48usize];
2165 ["Offset of field: playdate_sound_fileplayer::setLoopRange"]
2166 [::core::mem::offset_of!(playdate_sound_fileplayer, setLoopRange) - 52usize];
2167 ["Offset of field: playdate_sound_fileplayer::didUnderrun"]
2168 [::core::mem::offset_of!(playdate_sound_fileplayer, didUnderrun) - 56usize];
2169 ["Offset of field: playdate_sound_fileplayer::setFinishCallback"]
2170 [::core::mem::offset_of!(playdate_sound_fileplayer, setFinishCallback) - 60usize];
2171 ["Offset of field: playdate_sound_fileplayer::setLoopCallback"]
2172 [::core::mem::offset_of!(playdate_sound_fileplayer, setLoopCallback) - 64usize];
2173 ["Offset of field: playdate_sound_fileplayer::getOffset"]
2174 [::core::mem::offset_of!(playdate_sound_fileplayer, getOffset) - 68usize];
2175 ["Offset of field: playdate_sound_fileplayer::getRate"]
2176 [::core::mem::offset_of!(playdate_sound_fileplayer, getRate) - 72usize];
2177 ["Offset of field: playdate_sound_fileplayer::setStopOnUnderrun"]
2178 [::core::mem::offset_of!(playdate_sound_fileplayer, setStopOnUnderrun) - 76usize];
2179 ["Offset of field: playdate_sound_fileplayer::fadeVolume"]
2180 [::core::mem::offset_of!(playdate_sound_fileplayer, fadeVolume) - 80usize];
2181 ["Offset of field: playdate_sound_fileplayer::setMP3StreamSource"]
2182 [::core::mem::offset_of!(playdate_sound_fileplayer, setMP3StreamSource) - 84usize];
2183};
2184#[repr(C)]
2185#[derive(Debug, Copy, Clone)]
2186#[must_use]
2187pub struct AudioSample {
2188 _unused: [u8; 0],
2189}
2190#[repr(C)]
2191#[derive(Debug, Copy, Clone)]
2192#[must_use]
2193pub struct SamplePlayer {
2194 _unused: [u8; 0],
2195}
2196#[repr(C)]
2197#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2198#[must_use]
2199pub struct playdate_sound_sample {
2200 #[doc = "`AudioSample* playdate->sound->sample->newSampleBuffer(int length)`\n\nAllocates and returns a new AudioSample with a buffer large enough to load a file of *length* bytes."]
2201 pub newSampleBuffer:
2202 ::core::option::Option<unsafe extern "C" fn(byteCount: core::ffi::c_int) -> *mut AudioSample>,
2203 #[doc = "`void playdate->sound->sample->loadIntoSample(AudioSample* sample, const char* path)`\n\nLoads the sound data from the file at *path* into an existing AudioSample, *sample*."]
2204 pub loadIntoSample: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample,
2205 path: *const core::ffi::c_char)
2206 -> core::ffi::c_int>,
2207 #[doc = "`AudioSample* playdate->sound->sample->load(const char* path)`\n\nAllocates and returns a new AudioSample, with the sound data loaded in memory. If there is no file at *path*, the function returns null."]
2208 pub load: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char) -> *mut AudioSample>,
2209 #[doc = "`AudioSample* playdate->sound->sample->newSampleFromData(uint8_t* data, SoundFormat format, uint32_t sampleRate, int byteCount, int shouldFreeData)`\n\nReturns a new AudioSample referencing the given audio data. If *shouldFreeData* is set, *data* is freed when the sample object is [freed](#f-sound.sample.freeSample). The sample keeps a pointer to the data instead of copying it, so the data must remain valid while the sample is active. *format* is one of the following values:\n\nSoundFormat\n\n```cpp\ntypedef enum\n{\n\tkSound8bitMono = 0,\n\tkSound8bitStereo = 1,\n\tkSound16bitMono = 2,\n\tkSound16bitStereo = 3,\n\tkSoundADPCMMono = 4,\n\tkSoundADPCMStereo = 5\n} SoundFormat;\n```\n\n`pd_api_sound.h` also provides some helper macros and functions:\n\n```cpp\n#define SoundFormatIsStereo(f) ((f)&1)\n#define SoundFormatIs16bit(f) ((f)>=kSound16bitMono)\nstatic inline uint32_t SoundFormat_bytesPerFrame(SoundFormat fmt);\n```"]
2210 pub newSampleFromData: ::core::option::Option<unsafe extern "C" fn(data: *mut u8,
2211 format: SoundFormat,
2212 sampleRate: u32,
2213 byteCount: core::ffi::c_int,
2214 shouldFreeData: core::ffi::c_int)
2215 -> *mut AudioSample>,
2216 pub getData: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample,
2217 data: *mut *mut u8,
2218 format: *mut SoundFormat,
2219 sampleRate: *mut u32,
2220 bytelength: *mut u32)>,
2221 #[doc = "`void playdate->sound->sample->freeSample(AudioSample* sample)`\n\nFrees the given *sample*. If the sample was created with [playdate→sound→sample→newSampleFromData()](#f-sound.sample.newSampleFromData) and the *shouldFreeData* flag was set, the sample’s source data is also freed."]
2222 pub freeSample: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample)>,
2223 #[doc = "`float playdate->sound->sample->getLength(AudioSample* sample)`\n\nReturns the length, in seconds, of *sample*."]
2224 pub getLength: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample) -> core::ffi::c_float>,
2225 #[doc = "`int playdate->sound->sample->decompress(void)`\n\nIf the sample is ADPCM compressed, decompresses the sample data to 16-bit PCM data. This increases the sample’s memory footprint by 4x and does not affect the quality in any way, but it is necessary if you want to use the sample in a synth or play the file backwards. Returns 1 if successful, 0 if there’s not enough memory for the uncompressed data."]
2226 pub decompress: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample) -> core::ffi::c_int>,
2227}
2228#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2229const _: () = {
2230 ["Size of playdate_sound_sample"][::core::mem::size_of::<playdate_sound_sample>() - 32usize];
2231 ["Alignment of playdate_sound_sample"][::core::mem::align_of::<playdate_sound_sample>() - 4usize];
2232 ["Offset of field: playdate_sound_sample::newSampleBuffer"]
2233 [::core::mem::offset_of!(playdate_sound_sample, newSampleBuffer) - 0usize];
2234 ["Offset of field: playdate_sound_sample::loadIntoSample"]
2235 [::core::mem::offset_of!(playdate_sound_sample, loadIntoSample) - 4usize];
2236 ["Offset of field: playdate_sound_sample::load"]
2237 [::core::mem::offset_of!(playdate_sound_sample, load) - 8usize];
2238 ["Offset of field: playdate_sound_sample::newSampleFromData"]
2239 [::core::mem::offset_of!(playdate_sound_sample, newSampleFromData) - 12usize];
2240 ["Offset of field: playdate_sound_sample::getData"]
2241 [::core::mem::offset_of!(playdate_sound_sample, getData) - 16usize];
2242 ["Offset of field: playdate_sound_sample::freeSample"]
2243 [::core::mem::offset_of!(playdate_sound_sample, freeSample) - 20usize];
2244 ["Offset of field: playdate_sound_sample::getLength"]
2245 [::core::mem::offset_of!(playdate_sound_sample, getLength) - 24usize];
2246 ["Offset of field: playdate_sound_sample::decompress"]
2247 [::core::mem::offset_of!(playdate_sound_sample, decompress) - 28usize];
2248};
2249#[repr(C)]
2250#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2251#[must_use]
2252pub struct playdate_sound_sampleplayer {
2253 #[doc = "`SamplePlayer* playdate->sound->sampleplayer->newPlayer(void)`\n\nAllocates and returns a new SamplePlayer."]
2254 pub newPlayer: ::core::option::Option<unsafe extern "C" fn() -> *mut SamplePlayer>,
2255 #[doc = "`void playdate->sound->sampleplayer->freePlayer(SamplePlayer* player)`\n\nFrees the given *player*."]
2256 pub freePlayer: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer)>,
2257 #[doc = "`void playdate->sound->sampleplayer->setSample(SamplePlayer* player, AudioSample* sample)`\n\nAssigns *sample* to *player*."]
2258 pub setSample:
2259 ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, sample: *mut AudioSample)>,
2260 #[doc = "`int playdate->sound->sampleplayer->play(SamplePlayer* player, int repeat, float rate)`\n\nStarts playing the sample in *player*.\n\nIf *repeat* is greater than one, it loops the given number of times. If zero, it loops endlessly until it is stopped with [playdate-\\>sound-\\>sampleplayer-\\>stop()](#f-sound.sampleplayer.stop). If negative one, it does ping-pong looping.\n\n*rate* is the playback rate for the sample; 1.0 is normal speed, 0.5 is down an octave, 2.0 is up an octave, etc.\n\nReturns 1 on success (which is always, currently)."]
2261 pub play: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2262 repeat: core::ffi::c_int,
2263 rate: core::ffi::c_float)
2264 -> core::ffi::c_int>,
2265 #[doc = "`int playdate->sound->sampleplayer->isPlaying(SamplePlayer* player)`\n\nReturns one if *player* is playing a sample, zero if not."]
2266 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_int>,
2267 #[doc = "`void playdate->sound->sampleplayer->stop(SamplePlayer* player)`\n\nStops playing the sample."]
2268 pub stop: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer)>,
2269 #[doc = "`void playdate->sound->sampleplayer->setVolume(SamplePlayer* player, float left, float right)`\n\nSets the playback volume for left and right channels."]
2270 pub setVolume: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2271 left: core::ffi::c_float,
2272 right: core::ffi::c_float)>,
2273 #[doc = "`void playdate->sound->sampleplayer->getVolume(SamplePlayer* player, float* outleft, float* outright)`\n\nGets the current left and right channel volume of the sampleplayer."]
2274 pub getVolume: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2275 left: *mut core::ffi::c_float,
2276 right: *mut core::ffi::c_float)>,
2277 #[doc = "`float playdate->sound->sampleplayer->getLength(SamplePlayer* player)`\n\nReturns the length, in seconds, of the sample assigned to *player*."]
2278 pub getLength: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2279 #[doc = "`void playdate->sound->sampleplayer->setOffset(SamplePlayer* player, float offset)`\n\nSets the current *offset* of the SamplePlayer, in seconds."]
2280 pub setOffset:
2281 ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, offset: core::ffi::c_float)>,
2282 #[doc = "`void playdate->sound->sampleplayer->setRate(SamplePlayer* player, float rate)`\n\nSets the playback *rate* for the *player*. 1.0 is normal speed, 0.5 is down an octave, 2.0 is up an octave, etc. A negative rate produces backwards playback for PCM files, but does not work for ADPCM-encoded files."]
2283 pub setRate: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, rate: core::ffi::c_float)>,
2284 #[doc = "`void playdate->sound->sampleplayer->setPlayRange(SamplePlayer* player, int start, int end)`\n\nWhen used with a repeat of -1, does ping-pong looping, with a *start* and *end* position in frames."]
2285 pub setPlayRange: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2286 start: core::ffi::c_int,
2287 end: core::ffi::c_int)>,
2288 #[doc = "`void playdate->sound->sampleplayer->setFinishCallback(SamplePlayer* player, sndCallbackProc callback, void* userdata)`\n\nSets a function to be called when playback has completed. See [sndCallbackProc](#_sndCallbackProc)."]
2289 pub setFinishCallback: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2290 callback: sndCallbackProc,
2291 userdata: *mut core::ffi::c_void)>,
2292 pub setLoopCallback: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2293 callback: sndCallbackProc,
2294 userdata: *mut core::ffi::c_void)>,
2295 #[doc = "`float playdate->sound->sampleplayer->getOffset(SamplePlayer* player);`\n\nReturns the current offset in seconds for *player*."]
2296 pub getOffset: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2297 #[doc = "`float playdate->sound->sampleplayer->getRate(SamplePlayer* player)`\n\nReturns the playback rate for *player*."]
2298 pub getRate: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2299 #[doc = "`void playdate->sound->sampleplayer->setPaused(SamplePlayer* player, int paused)`\n\nPauses or resumes playback."]
2300 pub setPaused: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, flag: core::ffi::c_int)>,
2301}
2302#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2303const _: () = {
2304 ["Size of playdate_sound_sampleplayer"][::core::mem::size_of::<playdate_sound_sampleplayer>() - 68usize];
2305 ["Alignment of playdate_sound_sampleplayer"][::core::mem::align_of::<playdate_sound_sampleplayer>() - 4usize];
2306 ["Offset of field: playdate_sound_sampleplayer::newPlayer"]
2307 [::core::mem::offset_of!(playdate_sound_sampleplayer, newPlayer) - 0usize];
2308 ["Offset of field: playdate_sound_sampleplayer::freePlayer"]
2309 [::core::mem::offset_of!(playdate_sound_sampleplayer, freePlayer) - 4usize];
2310 ["Offset of field: playdate_sound_sampleplayer::setSample"]
2311 [::core::mem::offset_of!(playdate_sound_sampleplayer, setSample) - 8usize];
2312 ["Offset of field: playdate_sound_sampleplayer::play"]
2313 [::core::mem::offset_of!(playdate_sound_sampleplayer, play) - 12usize];
2314 ["Offset of field: playdate_sound_sampleplayer::isPlaying"]
2315 [::core::mem::offset_of!(playdate_sound_sampleplayer, isPlaying) - 16usize];
2316 ["Offset of field: playdate_sound_sampleplayer::stop"]
2317 [::core::mem::offset_of!(playdate_sound_sampleplayer, stop) - 20usize];
2318 ["Offset of field: playdate_sound_sampleplayer::setVolume"]
2319 [::core::mem::offset_of!(playdate_sound_sampleplayer, setVolume) - 24usize];
2320 ["Offset of field: playdate_sound_sampleplayer::getVolume"]
2321 [::core::mem::offset_of!(playdate_sound_sampleplayer, getVolume) - 28usize];
2322 ["Offset of field: playdate_sound_sampleplayer::getLength"]
2323 [::core::mem::offset_of!(playdate_sound_sampleplayer, getLength) - 32usize];
2324 ["Offset of field: playdate_sound_sampleplayer::setOffset"]
2325 [::core::mem::offset_of!(playdate_sound_sampleplayer, setOffset) - 36usize];
2326 ["Offset of field: playdate_sound_sampleplayer::setRate"]
2327 [::core::mem::offset_of!(playdate_sound_sampleplayer, setRate) - 40usize];
2328 ["Offset of field: playdate_sound_sampleplayer::setPlayRange"]
2329 [::core::mem::offset_of!(playdate_sound_sampleplayer, setPlayRange) - 44usize];
2330 ["Offset of field: playdate_sound_sampleplayer::setFinishCallback"]
2331 [::core::mem::offset_of!(playdate_sound_sampleplayer, setFinishCallback) - 48usize];
2332 ["Offset of field: playdate_sound_sampleplayer::setLoopCallback"]
2333 [::core::mem::offset_of!(playdate_sound_sampleplayer, setLoopCallback) - 52usize];
2334 ["Offset of field: playdate_sound_sampleplayer::getOffset"]
2335 [::core::mem::offset_of!(playdate_sound_sampleplayer, getOffset) - 56usize];
2336 ["Offset of field: playdate_sound_sampleplayer::getRate"]
2337 [::core::mem::offset_of!(playdate_sound_sampleplayer, getRate) - 60usize];
2338 ["Offset of field: playdate_sound_sampleplayer::setPaused"]
2339 [::core::mem::offset_of!(playdate_sound_sampleplayer, setPaused) - 64usize];
2340};
2341#[repr(C)]
2342#[derive(Debug, Copy, Clone)]
2343#[must_use]
2344pub struct PDSynthSignalValue {
2345 _unused: [u8; 0],
2346}
2347#[repr(C)]
2348#[derive(Debug, Copy, Clone)]
2349#[must_use]
2350pub struct PDSynthSignal {
2351 _unused: [u8; 0],
2352}
2353pub type signalStepFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2354 ioframes: *mut core::ffi::c_int,
2355 ifval: *mut core::ffi::c_float)
2356 -> core::ffi::c_float>;
2357pub type signalNoteOnFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2358 note: MIDINote,
2359 vel: core::ffi::c_float,
2360 len: core::ffi::c_float)>;
2361pub type signalNoteOffFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2362 stopped: core::ffi::c_int,
2363 offset: core::ffi::c_int)>;
2364pub type signalDeallocFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void)>;
2365#[repr(C)]
2366#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2367#[must_use]
2368pub struct playdate_sound_signal {
2369 #[doc = "`PDSynthSignal* playdate->sound->signal->newSignal(signalStepFunc step, signalNoteOnFunc noteOn, signalNoteOffFunc noteOff, signalDeallocFunc dealloc, void* userdata)`\n\nSignalCallbacks\n\n```cpp\ntypedef float (*signalStepFunc)(void* userdata, int* iosamples, float* ifval);\ntypedef void (*signalNoteOnFunc)(void* userdata, MIDINote note, float vel, float len); // len = -1 for indefinite\ntypedef void (*signalNoteOffFunc)(void* userdata, int stopped, int offset); // stopped = 0 on note release, = 1 when note actually stops playing; offset is # of frames into the current cycle\ntypedef void (*signalDeallocFunc)(void* userdata);\n```\n\nProvides a custom implementation for the signal. *signalStepFunc step* is the only required function, returning the value at the end of the current frame. When called, the *ioframes* pointer contains the number of samples until the end of the frame. If the signal needs to provide a value in the middle of the frame (e.g. an LFO that needs to be sample-accurate) it should return the \"interframe\" value in *ifval* and set *iosamples* to the sample offset of the value. The functions are called on the audio render thread, so they should return as quickly as possible."]
2370 pub newSignal: ::core::option::Option<unsafe extern "C" fn(step: signalStepFunc,
2371 noteOn: signalNoteOnFunc,
2372 noteOff: signalNoteOffFunc,
2373 dealloc: signalDeallocFunc,
2374 userdata: *mut core::ffi::c_void)
2375 -> *mut PDSynthSignal>,
2376 #[doc = "`void playdate->sound->signal->freeSignal(PDSynthSignal* signal);`\n\nFrees a signal created with *playdate→sound→signal→newSignal()*."]
2377 pub freeSignal: ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal)>,
2378 #[doc = "`float playdate->sound->signal->getValue(PDSynthSignal* signal);`\n\nReturns the current output value of *signal*. The signal can be a custom signal created with newSignal(), or any of the PDSynthSignal subclasses."]
2379 pub getValue: ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal) -> core::ffi::c_float>,
2380 #[doc = "`void playdate->sound->signal->setValueScale(PDSynthSignal* signal, float scale);`\n\nScales the signal’s output by the given factor. The scale is applied before the offset."]
2381 pub setValueScale:
2382 ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal, scale: core::ffi::c_float)>,
2383 #[doc = "`void playdate->sound->signal->setValueOffset(PDSynthSignal* signal, float offset);`\n\nOffsets the signal’s output by the given amount."]
2384 pub setValueOffset:
2385 ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal, offset: core::ffi::c_float)>,
2386 #[doc = "`PDSynthSignal* playdate->sound->signal->newSignalForValue(PDSynthSignalValue* value)`\n\nCreates a new PDSynthSignal that tracks a PDSynthSignalValue."]
2387 pub newSignalForValue:
2388 ::core::option::Option<unsafe extern "C" fn(value: *mut PDSynthSignalValue) -> *mut PDSynthSignal>,
2389}
2390#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2391const _: () = {
2392 ["Size of playdate_sound_signal"][::core::mem::size_of::<playdate_sound_signal>() - 24usize];
2393 ["Alignment of playdate_sound_signal"][::core::mem::align_of::<playdate_sound_signal>() - 4usize];
2394 ["Offset of field: playdate_sound_signal::newSignal"]
2395 [::core::mem::offset_of!(playdate_sound_signal, newSignal) - 0usize];
2396 ["Offset of field: playdate_sound_signal::freeSignal"]
2397 [::core::mem::offset_of!(playdate_sound_signal, freeSignal) - 4usize];
2398 ["Offset of field: playdate_sound_signal::getValue"]
2399 [::core::mem::offset_of!(playdate_sound_signal, getValue) - 8usize];
2400 ["Offset of field: playdate_sound_signal::setValueScale"]
2401 [::core::mem::offset_of!(playdate_sound_signal, setValueScale) - 12usize];
2402 ["Offset of field: playdate_sound_signal::setValueOffset"]
2403 [::core::mem::offset_of!(playdate_sound_signal, setValueOffset) - 16usize];
2404 ["Offset of field: playdate_sound_signal::newSignalForValue"]
2405 [::core::mem::offset_of!(playdate_sound_signal, newSignalForValue) - 20usize];
2406};
2407#[repr(u8)]
2408#[must_use]
2409#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2410pub enum LFOType {
2411 kLFOTypeSquare = 0,
2412 kLFOTypeTriangle = 1,
2413 kLFOTypeSine = 2,
2414 kLFOTypeSampleAndHold = 3,
2415 kLFOTypeSawtoothUp = 4,
2416 kLFOTypeSawtoothDown = 5,
2417 kLFOTypeArpeggiator = 6,
2418 kLFOTypeFunction = 7,
2419}
2420#[repr(C)]
2421#[derive(Debug, Copy, Clone)]
2422#[must_use]
2423pub struct PDSynthLFO {
2424 _unused: [u8; 0],
2425}
2426#[repr(C)]
2427#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2428#[must_use]
2429pub struct playdate_sound_lfo { # [doc = "`PDSynthLFO* playdate->sound->lfo->newLFO(LFOType type)`\n\nReturns a new LFO object, which can be used to modulate sounds. The *type* argument is one of the following values:\n\nLFOType\n\n```cpp\ntypedef enum\n{\n\tkLFOTypeSquare,\n\tkLFOTypeTriangle,\n\tkLFOTypeSine,\n\tkLFOTypeSampleAndHold,\n\tkLFOTypeSawtoothUp,\n\tkLFOTypeSawtoothDown,\n\tkLFOTypeArpeggiator,\n\tkLFOTypeFunction\n} LFOType;\n```"] pub newLFO : :: core :: option :: Option < unsafe extern "C" fn (type_ : LFOType) -> * mut PDSynthLFO > , # [doc = "`void playdate->sound->lfo->freeLFO(PDSynthLFO* lfo)`\n\nFrees the LFO."] pub freeLFO : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO) > , # [doc = "`void playdate->sound->lfo->setType(PDSynthLFO* lfo, LFOType type)`\n\nSets the LFO shape to one of the values given above."] pub setType : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , type_ : LFOType) > , # [doc = "`void playdate->sound->lfo->setRate(PDSynthLFO* lfo, float rate)`\n\nSets the LFO’s rate, in cycles per second."] pub setRate : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , rate : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setPhase(PDSynthLFO* lfo, float phase)`\n\nSets the LFO’s phase, from 0 to 1."] pub setPhase : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , phase : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setCenter(PDSynthLFO* lfo, float center)`\n\nSets the center value for the LFO."] pub setCenter : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , center : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setDepth(PDSynthLFO* lfo, float depth)`\n\nSets the depth of the LFO."] pub setDepth : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , depth : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setArpeggiation(PDSynthLFO* lfo, int nSteps, float* steps)`\n\nSets the LFO type to arpeggio, where the given values are in half-steps from the center note. For example, the sequence (0, 4, 7, 12) plays the notes of a major chord."] pub setArpeggiation : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , nSteps : core :: ffi :: c_int , steps : * mut core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setFunction(PDSynthLFO* lfo, float (*lfoFunc)(PDSynthLFO* lfo, void* userdata), void* userdata, int interpolate)`\n\nProvides a custom function for LFO values."] pub setFunction : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , lfoFunc : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , userdata : * mut core :: ffi :: c_void) -> core :: ffi :: c_float > , userdata : * mut core :: ffi :: c_void , interpolate : core :: ffi :: c_int) > , # [doc = "`void playdate->sound->lfo->setDelay(PDSynthLFO* lfo, float holdoff, float ramptime)`\n\nSets an initial holdoff time for the LFO where the LFO remains at its center value, and a ramp time where the value increases linearly to its maximum depth. Values are in seconds."] pub setDelay : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , holdoff : core :: ffi :: c_float , ramptime : core :: ffi :: c_float) > , # [doc = "`void playdate->sound->lfo->setRetrigger(PDSynthLFO* lfo, int flag)`\n\nIf retrigger is on, the LFO’s phase is reset to its initial phase (default 0) when a synth using the LFO starts playing a note."] pub setRetrigger : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , flag : core :: ffi :: c_int) > , # [doc = "`float playdate->sound->lfo->getValue(PDSynthLFO* lfo)`\n\nReturn the current output value of the LFO."] pub getValue : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO) -> core :: ffi :: c_float > , # [doc = "`void playdate->sound->lfo->setGlobal(PDSynthLFO* lfo, int global)`\n\nIf *global* is set, the LFO is continuously updated whether or not it’s currently in use."] pub setGlobal : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , global : core :: ffi :: c_int) > , # [doc = "`void playdate->sound->lfo->setStartPhase(PDSynthLFO* lfo, float phase)`\n\nSets the LFO’s initial phase, from 0 to 1."] pub setStartPhase : :: core :: option :: Option < unsafe extern "C" fn (lfo : * mut PDSynthLFO , phase : core :: ffi :: c_float) > , }
2430#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2431const _: () = {
2432 ["Size of playdate_sound_lfo"][::core::mem::size_of::<playdate_sound_lfo>() - 56usize];
2433 ["Alignment of playdate_sound_lfo"][::core::mem::align_of::<playdate_sound_lfo>() - 4usize];
2434 ["Offset of field: playdate_sound_lfo::newLFO"][::core::mem::offset_of!(playdate_sound_lfo, newLFO) - 0usize];
2435 ["Offset of field: playdate_sound_lfo::freeLFO"]
2436 [::core::mem::offset_of!(playdate_sound_lfo, freeLFO) - 4usize];
2437 ["Offset of field: playdate_sound_lfo::setType"]
2438 [::core::mem::offset_of!(playdate_sound_lfo, setType) - 8usize];
2439 ["Offset of field: playdate_sound_lfo::setRate"]
2440 [::core::mem::offset_of!(playdate_sound_lfo, setRate) - 12usize];
2441 ["Offset of field: playdate_sound_lfo::setPhase"]
2442 [::core::mem::offset_of!(playdate_sound_lfo, setPhase) - 16usize];
2443 ["Offset of field: playdate_sound_lfo::setCenter"]
2444 [::core::mem::offset_of!(playdate_sound_lfo, setCenter) - 20usize];
2445 ["Offset of field: playdate_sound_lfo::setDepth"]
2446 [::core::mem::offset_of!(playdate_sound_lfo, setDepth) - 24usize];
2447 ["Offset of field: playdate_sound_lfo::setArpeggiation"]
2448 [::core::mem::offset_of!(playdate_sound_lfo, setArpeggiation) - 28usize];
2449 ["Offset of field: playdate_sound_lfo::setFunction"]
2450 [::core::mem::offset_of!(playdate_sound_lfo, setFunction) - 32usize];
2451 ["Offset of field: playdate_sound_lfo::setDelay"]
2452 [::core::mem::offset_of!(playdate_sound_lfo, setDelay) - 36usize];
2453 ["Offset of field: playdate_sound_lfo::setRetrigger"]
2454 [::core::mem::offset_of!(playdate_sound_lfo, setRetrigger) - 40usize];
2455 ["Offset of field: playdate_sound_lfo::getValue"]
2456 [::core::mem::offset_of!(playdate_sound_lfo, getValue) - 44usize];
2457 ["Offset of field: playdate_sound_lfo::setGlobal"]
2458 [::core::mem::offset_of!(playdate_sound_lfo, setGlobal) - 48usize];
2459 ["Offset of field: playdate_sound_lfo::setStartPhase"]
2460 [::core::mem::offset_of!(playdate_sound_lfo, setStartPhase) - 52usize];
2461};
2462#[repr(C)]
2463#[derive(Debug, Copy, Clone)]
2464#[must_use]
2465pub struct PDSynthEnvelope {
2466 _unused: [u8; 0],
2467}
2468#[repr(C)]
2469#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2470#[must_use]
2471pub struct playdate_sound_envelope {
2472 #[doc = "`PDSynthEnvelope* playdate->sound->envelope->newEnvelope(float attack, float decay, float sustain, float release)`\n\nCreates a new envelope with the given parameters."]
2473 pub newEnvelope: ::core::option::Option<unsafe extern "C" fn(attack: core::ffi::c_float,
2474 decay: core::ffi::c_float,
2475 sustain: core::ffi::c_float,
2476 release: core::ffi::c_float)
2477 -> *mut PDSynthEnvelope>,
2478 #[doc = "`void playdate->sound->envelope->freeEnvelope(PDSynthEnvelope* env)`\n\nFrees the envelope."]
2479 pub freeEnvelope: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope)>,
2480 #[doc = "`void playdate->sound->envelope->setAttack(PDSynthEnvelope* env, float attack)`"]
2481 pub setAttack:
2482 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, attack: core::ffi::c_float)>,
2483 #[doc = "`void playdate->sound->envelope->setDecay(PDSynthEnvelope* env, float decay)`"]
2484 pub setDecay:
2485 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, decay: core::ffi::c_float)>,
2486 #[doc = "`void playdate->sound->envelope->setSustain(PDSynthEnvelope* env, float sustain)`"]
2487 pub setSustain:
2488 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, sustain: core::ffi::c_float)>,
2489 #[doc = "`void playdate->sound->envelope->setRelease(PDSynthEnvelope* env, float release)`\n\nSets the ADSR parameters of the envelope."]
2490 pub setRelease:
2491 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, release: core::ffi::c_float)>,
2492 #[doc = "`void playdate->sound->envelope->setLegato(PDSynthEnvelope* env, int flag)`\n\nSets whether to use legato phrasing for the envelope. If the legato flag is set, when the envelope is re-triggered before it’s released, it remains in the sustain phase instead of jumping back to the attack phase."]
2493 pub setLegato: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, flag: core::ffi::c_int)>,
2494 #[doc = "`void playdate->sound->envelope->setRetrigger(PDSynthEnvelope* env, int flag)`\n\nIf retrigger is on, the envelope always starts from 0 when a note starts playing, instead of the current value if it’s active."]
2495 pub setRetrigger:
2496 ::core::option::Option<unsafe extern "C" fn(lfo: *mut PDSynthEnvelope, flag: core::ffi::c_int)>,
2497 #[doc = "`float playdate->sound->envelope->getValue(PDSynthEnvelope* env)`\n\nReturn the current output value of the envelope."]
2498 pub getValue: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope) -> core::ffi::c_float>,
2499 #[doc = "`void playdate->sound->envelope->setCurvature(PDSynthEnvelope* env, float amount)`\n\nSmoothly changes the envelope’s shape from linear (amount=0) to exponential (amount=1)."]
2500 pub setCurvature:
2501 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, amount: core::ffi::c_float)>,
2502 #[doc = "`void playdate->sound->envelope->setVelocitySensitivity(PDSynthEnvelope* env, float velsens)`\n\nChanges the amount by which note velocity scales output level. At the default value of 1, output is proportional to velocity; at 0 velocity has no effect on output level."]
2503 pub setVelocitySensitivity:
2504 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, velsens: core::ffi::c_float)>,
2505 #[doc = "`void playdate->sound->envelope->setRateScaling(PDSynthEnvelope* env, float scaling, MIDINote start, MIDINote end)`\n\nScales the envelope rate according to the played note. For notes below `start`, the envelope’s set rate is used; for notes above `end` envelope rates are scaled by the `scaling` parameter. Between the two notes the scaling factor is interpolated from 1.0 to `scaling`."]
2506 pub setRateScaling: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope,
2507 scaling: core::ffi::c_float,
2508 start: MIDINote,
2509 end: MIDINote)>,
2510}
2511#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2512const _: () = {
2513 ["Size of playdate_sound_envelope"][::core::mem::size_of::<playdate_sound_envelope>() - 48usize];
2514 ["Alignment of playdate_sound_envelope"][::core::mem::align_of::<playdate_sound_envelope>() - 4usize];
2515 ["Offset of field: playdate_sound_envelope::newEnvelope"]
2516 [::core::mem::offset_of!(playdate_sound_envelope, newEnvelope) - 0usize];
2517 ["Offset of field: playdate_sound_envelope::freeEnvelope"]
2518 [::core::mem::offset_of!(playdate_sound_envelope, freeEnvelope) - 4usize];
2519 ["Offset of field: playdate_sound_envelope::setAttack"]
2520 [::core::mem::offset_of!(playdate_sound_envelope, setAttack) - 8usize];
2521 ["Offset of field: playdate_sound_envelope::setDecay"]
2522 [::core::mem::offset_of!(playdate_sound_envelope, setDecay) - 12usize];
2523 ["Offset of field: playdate_sound_envelope::setSustain"]
2524 [::core::mem::offset_of!(playdate_sound_envelope, setSustain) - 16usize];
2525 ["Offset of field: playdate_sound_envelope::setRelease"]
2526 [::core::mem::offset_of!(playdate_sound_envelope, setRelease) - 20usize];
2527 ["Offset of field: playdate_sound_envelope::setLegato"]
2528 [::core::mem::offset_of!(playdate_sound_envelope, setLegato) - 24usize];
2529 ["Offset of field: playdate_sound_envelope::setRetrigger"]
2530 [::core::mem::offset_of!(playdate_sound_envelope, setRetrigger) - 28usize];
2531 ["Offset of field: playdate_sound_envelope::getValue"]
2532 [::core::mem::offset_of!(playdate_sound_envelope, getValue) - 32usize];
2533 ["Offset of field: playdate_sound_envelope::setCurvature"]
2534 [::core::mem::offset_of!(playdate_sound_envelope, setCurvature) - 36usize];
2535 ["Offset of field: playdate_sound_envelope::setVelocitySensitivity"]
2536 [::core::mem::offset_of!(playdate_sound_envelope, setVelocitySensitivity) - 40usize];
2537 ["Offset of field: playdate_sound_envelope::setRateScaling"]
2538 [::core::mem::offset_of!(playdate_sound_envelope, setRateScaling) - 44usize];
2539};
2540#[repr(u8)]
2541#[must_use]
2542#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2543pub enum SoundWaveform {
2544 kWaveformSquare = 0,
2545 kWaveformTriangle = 1,
2546 kWaveformSine = 2,
2547 kWaveformNoise = 3,
2548 kWaveformSawtooth = 4,
2549 kWaveformPOPhase = 5,
2550 kWaveformPODigital = 6,
2551 kWaveformPOVosim = 7,
2552}
2553pub type synthRenderFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2554 left: *mut i32,
2555 right: *mut i32,
2556 nsamples: core::ffi::c_int,
2557 rate: u32,
2558 drate: i32)
2559 -> core::ffi::c_int>;
2560pub type synthNoteOnFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2561 note: MIDINote,
2562 velocity: core::ffi::c_float,
2563 len: core::ffi::c_float)>;
2564pub type synthReleaseFunc =
2565 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void, stop: core::ffi::c_int)>;
2566pub type synthSetParameterFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2567 parameter: core::ffi::c_int,
2568 value: core::ffi::c_float)
2569 -> core::ffi::c_int>;
2570pub type synthDeallocFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void)>;
2571pub type synthCopyUserdata =
2572 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void) -> *mut core::ffi::c_void>;
2573#[repr(C)]
2574#[derive(Debug, Copy, Clone)]
2575#[must_use]
2576pub struct PDSynth {
2577 _unused: [u8; 0],
2578}
2579#[repr(C)]
2580#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2581#[must_use]
2582pub struct playdate_sound_synth {
2583 #[doc = "`PDSynth* playdate->sound->synth->newSynth(void)`\n\nCreates a new synth object."]
2584 pub newSynth: ::core::option::Option<unsafe extern "C" fn() -> *mut PDSynth>,
2585 #[doc = "`void playdate->sound->synth->freeSynth(PDSynth* synth)`\n\nFrees a synth object, first removing it from the sound engine if needed."]
2586 pub freeSynth: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2587 #[doc = "`void playdate->sound->synth->setWaveform(PDSynth* synth, SoundWaveform wave)`\n\nSets the waveform of the synth. The SoundWaveform enum contains the following values:\n\nSoundWaveform\n\n```cpp\ntypedef enum\n{\n\tkWaveformSquare,\n\tkWaveformTriangle,\n\tkWaveformSine,\n\tkWaveformNoise,\n\tkWaveformSawtooth,\n\tkWaveformPOPhase,\n\tkWaveformPODigital,\n\tkWaveformPOVosim\n} SoundWaveform;\n```"]
2588 pub setWaveform: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, wave: SoundWaveform)>,
2589 pub setGenerator_deprecated: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2590 stereo: core::ffi::c_int,
2591 render: synthRenderFunc,
2592 noteOn: synthNoteOnFunc,
2593 release: synthReleaseFunc,
2594 setparam: synthSetParameterFunc,
2595 dealloc: synthDeallocFunc,
2596 userdata: *mut core::ffi::c_void)>,
2597 #[doc = "`void playdate->sound->synth->setSample(PDSynth* synth, AudioSample* sample, uint32_t sustainStart, uint32_t sustainEnd)`\n\nProvides a sample for the synth to play. Sample data must be uncompressed PCM, not ADPCM. If a sustain range is set, it is looped while the synth is playing a note. When the note ends, if an envelope has been set on the synth and the sustain range goes to the end of the sample (i.e. there’s no release section of the sample after the sustain range) then the sustain section continues looping during the envelope release; otherwise it plays through the end of the sample and stops. As a convenience, if `sustainEnd` is zero and `sustainStart` is greater than zero, `sustainEnd` will be set to the length of the sample."]
2598 pub setSample: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2599 sample: *mut AudioSample,
2600 sustainStart: u32,
2601 sustainEnd: u32)>,
2602 #[doc = "`void playdate->sound->synth->setAttackTime(PDSynth* synth, float attack)`"]
2603 pub setAttackTime:
2604 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, attack: core::ffi::c_float)>,
2605 #[doc = "`void playdate->sound->synth->setDecayTime(PDSynth* synth, float decay)`"]
2606 pub setDecayTime: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, decay: core::ffi::c_float)>,
2607 #[doc = "`void playdate->sound->synth->setSustainLevel(PDSynth* synth, float sustain)`"]
2608 pub setSustainLevel:
2609 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, sustain: core::ffi::c_float)>,
2610 #[doc = "`void playdate->sound->synth->setReleaseTime(PDSynth* synth, float release)`\n\nSets the parameters of the synth’s ADSR envelope."]
2611 pub setReleaseTime:
2612 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, release: core::ffi::c_float)>,
2613 #[doc = "`void playdate->sound->synth->setTranspose(PDSynth* synth, float halfSteps)`\n\nTransposes the synth’s output by the given number of half steps. For example, if the transpose is set to 2 and a C note is played, the synth will output a D instead."]
2614 pub setTranspose:
2615 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, halfSteps: core::ffi::c_float)>,
2616 #[doc = "`void playdate->sound->synth->setFrequencyModulator(PDSynth* synth, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the synth’s frequency. The signal is scaled so that a value of 1 doubles the synth pitch (i.e. an octave up) and -1 halves it (an octave down). Set to *NULL* to clear the modulator."]
2617 pub setFrequencyModulator:
2618 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, mod_: *mut PDSynthSignalValue)>,
2619 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getFrequencyModulator(PDSynth* synth)`\n\nReturns the currently set frequency modulator."]
2620 pub getFrequencyModulator:
2621 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthSignalValue>,
2622 #[doc = "`void playdate->sound->synth->setAmplitudeModulator(PDSynth* synth, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the synth’s output amplitude. Set to *NULL* to clear the modulator."]
2623 pub setAmplitudeModulator:
2624 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, mod_: *mut PDSynthSignalValue)>,
2625 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getAmplitudeModulator(PDSynth* synth)`\n\nReturns the currently set amplitude modulator."]
2626 pub getAmplitudeModulator:
2627 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthSignalValue>,
2628 #[doc = "`int playdate->sound->synth->getParameterCount(PDSynth* synth)`\n\nReturns the number of parameters advertised by the synth."]
2629 pub getParameterCount: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> core::ffi::c_int>,
2630 #[doc = "`int playdate->sound->synth->setParameter(PDSynth* synth, int num, float value)`\n\nSets the (1-based) parameter at position *num* to the given value. Returns 0 if *num* is not a valid parameter index."]
2631 pub setParameter: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2632 parameter: core::ffi::c_int,
2633 value: core::ffi::c_float)
2634 -> core::ffi::c_int>,
2635 #[doc = "`void playdate->sound->synth->setParameterModulator(PDSynth* synth, int num, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the parameter at index *num*. Set to *NULL* to clear the modulator."]
2636 pub setParameterModulator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2637 parameter: core::ffi::c_int,
2638 mod_: *mut PDSynthSignalValue)>,
2639 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getParameterModulator(PDSynth* synth, int num)`\n\nReturns the currently set parameter modulator for the given index."]
2640 pub getParameterModulator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2641 parameter: core::ffi::c_int)
2642 -> *mut PDSynthSignalValue>,
2643 #[doc = "`void playdate->sound->synth->playNote(PDSynth* synth, float freq, float vel, float len, uint32_t when)`\n\nPlays a note on the synth, at the given frequency. Specify *len* = -1 to leave the note playing until a subsequent noteOff() call. If *when* is 0, the note is played immediately, otherwise the note is scheduled for the given time. Use [playdate→sound→getCurrentTime()](#f-sound.getCurrentTime) to get the current time."]
2644 pub playNote: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2645 freq: core::ffi::c_float,
2646 vel: core::ffi::c_float,
2647 len: core::ffi::c_float,
2648 when: u32)>,
2649 #[doc = "`void playdate->sound->synth->playMIDINote(PDSynth* synth, MIDINote note, float vel, float len, uint32_t when)`\n\nThe same as [playNote](#f-sound.synth.playNote) but uses MIDI note (where 60 = C4) instead of frequency. Note that `MIDINote` is a typedef for `float', meaning fractional values are allowed (for all you microtuning enthusiasts)."]
2650 pub playMIDINote: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2651 note: MIDINote,
2652 vel: core::ffi::c_float,
2653 len: core::ffi::c_float,
2654 when: u32)>,
2655 #[doc = "`void playdate->sound->synth->noteOff(PDSynth* synth, uint32_t when)`\n\nSends a note off event to the synth, either immediately (*when* = 0) or at the scheduled time."]
2656 pub noteOff: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, when: u32)>,
2657 pub stop: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2658 #[doc = "`void playdate->sound->synth->setVolume(PDSynth* synth, float lvol, float rvol)`\n\nSets the playback volume (0.0 - 1.0) for the left and, if the synth is stereo, right channels of the synth. This is equivalent to\n\n```cpp\nplaydate->sound->source->setVolume((SoundSource*)synth, lvol, rvol);\n```"]
2659 pub setVolume: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2660 left: core::ffi::c_float,
2661 right: core::ffi::c_float)>,
2662 #[doc = "`float playdate->sound->synth->getVolume(PDSynth* synth, float* outlvol, float* outrvol)`\n\nGets the playback volume for the left and right (if stereo) channels of the synth. This is equivalent to\n\n```cpp\nplaydate->sound->source->getVolume((SoundSource*)synth, outlvol, outrvol);\n```"]
2663 pub getVolume: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2664 left: *mut core::ffi::c_float,
2665 right: *mut core::ffi::c_float)>,
2666 #[doc = "`int playdate->sound->synth->isPlaying(PDSynth* synth)`\n\nReturns 1 if the synth is currently playing."]
2667 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> core::ffi::c_int>,
2668 #[doc = "`PDSynthEnvelope* playdate->sound->synth->getEnvelope(PDSynth* synth)`\n\nReturns the synth’s envelope. The PDSynth object owns this envelope, so it must not be freed."]
2669 pub getEnvelope: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthEnvelope>,
2670 #[doc = "`int playdate->sound->synth->setWavetable(PDSynth* synth, AudioSample* sample, int log2size, int columns, rows)`\n\nSets a wavetable for the synth to play. Sample data must be 16-bit mono uncompressed. `log2size` is the base 2 logarithm of the number of samples in each waveform \"cell\" in the table, and `columns` and `rows` gives the number of cells in each direction; for example, if the wavetable is arranged in an 8x8 grid, `columns` and `rows` are both 8 and `log2size` is 6, since 2^6 = 8x8.\n\nThe function returns 1 on success. If it fails, use [playdate→sound→getError()](#f-sound.getError) to get a human-readable error message.\n\nThe synth’s \"position\" in the wavetable is set manually with [setParameter()](#f-sound.synth.setParameter) or automated with [setParameterModulator()](#f-sound.synth.setParameterModulator). In some cases it’s easier to use a parameter that matches the waveform position in the table, in others (notably when using envelopes and lfos) it’s more convenient to use a 0-1 scale, so there’s some redundancy here. Parameters are\n\n* 1: x position, values are from 0 to the table width\n\n* 2: x position, values are from 0 to 1, parameter is scaled up to table width\n\nFor 2-D tables (`height` \\> 1):\n\n* 3: y position, values are from 0 to the table height\n\n* 4: y position, values are from 0 to 1, parameter is scaled up to table height"]
2671 pub setWavetable: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2672 sample: *mut AudioSample,
2673 log2size: core::ffi::c_int,
2674 columns: core::ffi::c_int,
2675 rows: core::ffi::c_int)
2676 -> core::ffi::c_int>,
2677 #[doc = "`void playdate->sound->synth->setGenerator(PDSynth* synth, int stereo, synthRenderFunc* render, synthNoteOnFunc* noteOn, synthReleaseFunc* release, synthSetParameterFunc* setparam, synthDeallocFunc* dealloc, synthCopyUserdataFunc copyUserdata, void* userdata)`\n\nGeneratorCallbacks\n\n```cpp\ntypedef int (*synthRenderFunc)(void* userdata, int32_t* left, int32_t* right, int nsamples, uint32_t rate, int32_t drate);\ntypedef void (*synthNoteOnFunc)(void* userdata, MIDINote note, float velocity, float len); // len == -1 if indefinite\ntypedef void (*synthReleaseFunc)(void* userdata, int endoffset);\ntypedef int (*synthSetParameterFunc)(void* userdata, int parameter, float value);\ntypedef void (*synthDeallocFunc)(void* userdata);\ntypedef void* (*synthCopyUserdata)(void* userdata);\n```\n\nProvides custom waveform generator functions for the synth. These functions are called on the audio render thread, so they should return as quickly as possible. *synthRenderFunc*, the data provider callback, is the only required function.\n\n*synthRenderFunc*: called every audio cycle to get the samples for playback. *left* (and *right* if *setGenerator()* was called with the stereo flag set) are sample buffers in Q8.24 format. *rate* is the amount to change a (Q32) phase accumulator each sample, and *drate* is the amount to change *rate* each sample. Custom synths can ignore this and use the *note* paramter in the noteOn function to handle pitch, but synth→setFrequencyModulator() won’t work as expected.\n\n*synthNoteOnFunc*: called when the synth receives a note on event. *len* is the length of the note in seconds, or -1 if it’s not known yet when the note will end.\n\n*synthReleaseFunc*: called when the synth receives a note off event. *endoffset* is how many samples into the current render cycle the note ends, allowing for sample-accurate timing.\n\n*synthSetParameterFunc*: called when a parameter change is received from [synth→setParameter()](#f-sound.synth.setParameter) or a modulator.\n\n*synthDeallocFunc*: called when the synth is being dealloced. This function should free anything that was allocated for the synth and also free the *userdata* itself.\n\n*synthCopyUserdata*: called when [synth→copy()](#f-sound.synth.copy) needs a unique copy of the synth’s userdata. External objects should be retained or copied so that the object isn’t freed while the synth is still using it."]
2678 pub setGenerator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2679 stereo: core::ffi::c_int,
2680 render: synthRenderFunc,
2681 noteOn: synthNoteOnFunc,
2682 release: synthReleaseFunc,
2683 setparam: synthSetParameterFunc,
2684 dealloc: synthDeallocFunc,
2685 copyUserdata: synthCopyUserdata,
2686 userdata: *mut core::ffi::c_void)>,
2687 #[doc = "`PDSynth* playdate->sound->synth->copy(PDSynth* synth)`\n\nReturns a copy of the given synth. Caller assumes ownership of the returned object and should free it when it is no longer in use."]
2688 pub copy: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynth>,
2689 #[doc = "`void playdate->sound->synth->clearEnvelope(PDSynth* synth)`\n\nClears the synth’s envelope settings."]
2690 pub clearEnvelope: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2691}
2692#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2693const _: () = {
2694 ["Size of playdate_sound_synth"][::core::mem::size_of::<playdate_sound_synth>() - 120usize];
2695 ["Alignment of playdate_sound_synth"][::core::mem::align_of::<playdate_sound_synth>() - 4usize];
2696 ["Offset of field: playdate_sound_synth::newSynth"]
2697 [::core::mem::offset_of!(playdate_sound_synth, newSynth) - 0usize];
2698 ["Offset of field: playdate_sound_synth::freeSynth"]
2699 [::core::mem::offset_of!(playdate_sound_synth, freeSynth) - 4usize];
2700 ["Offset of field: playdate_sound_synth::setWaveform"]
2701 [::core::mem::offset_of!(playdate_sound_synth, setWaveform) - 8usize];
2702 ["Offset of field: playdate_sound_synth::setGenerator_deprecated"]
2703 [::core::mem::offset_of!(playdate_sound_synth, setGenerator_deprecated) - 12usize];
2704 ["Offset of field: playdate_sound_synth::setSample"]
2705 [::core::mem::offset_of!(playdate_sound_synth, setSample) - 16usize];
2706 ["Offset of field: playdate_sound_synth::setAttackTime"]
2707 [::core::mem::offset_of!(playdate_sound_synth, setAttackTime) - 20usize];
2708 ["Offset of field: playdate_sound_synth::setDecayTime"]
2709 [::core::mem::offset_of!(playdate_sound_synth, setDecayTime) - 24usize];
2710 ["Offset of field: playdate_sound_synth::setSustainLevel"]
2711 [::core::mem::offset_of!(playdate_sound_synth, setSustainLevel) - 28usize];
2712 ["Offset of field: playdate_sound_synth::setReleaseTime"]
2713 [::core::mem::offset_of!(playdate_sound_synth, setReleaseTime) - 32usize];
2714 ["Offset of field: playdate_sound_synth::setTranspose"]
2715 [::core::mem::offset_of!(playdate_sound_synth, setTranspose) - 36usize];
2716 ["Offset of field: playdate_sound_synth::setFrequencyModulator"]
2717 [::core::mem::offset_of!(playdate_sound_synth, setFrequencyModulator) - 40usize];
2718 ["Offset of field: playdate_sound_synth::getFrequencyModulator"]
2719 [::core::mem::offset_of!(playdate_sound_synth, getFrequencyModulator) - 44usize];
2720 ["Offset of field: playdate_sound_synth::setAmplitudeModulator"]
2721 [::core::mem::offset_of!(playdate_sound_synth, setAmplitudeModulator) - 48usize];
2722 ["Offset of field: playdate_sound_synth::getAmplitudeModulator"]
2723 [::core::mem::offset_of!(playdate_sound_synth, getAmplitudeModulator) - 52usize];
2724 ["Offset of field: playdate_sound_synth::getParameterCount"]
2725 [::core::mem::offset_of!(playdate_sound_synth, getParameterCount) - 56usize];
2726 ["Offset of field: playdate_sound_synth::setParameter"]
2727 [::core::mem::offset_of!(playdate_sound_synth, setParameter) - 60usize];
2728 ["Offset of field: playdate_sound_synth::setParameterModulator"]
2729 [::core::mem::offset_of!(playdate_sound_synth, setParameterModulator) - 64usize];
2730 ["Offset of field: playdate_sound_synth::getParameterModulator"]
2731 [::core::mem::offset_of!(playdate_sound_synth, getParameterModulator) - 68usize];
2732 ["Offset of field: playdate_sound_synth::playNote"]
2733 [::core::mem::offset_of!(playdate_sound_synth, playNote) - 72usize];
2734 ["Offset of field: playdate_sound_synth::playMIDINote"]
2735 [::core::mem::offset_of!(playdate_sound_synth, playMIDINote) - 76usize];
2736 ["Offset of field: playdate_sound_synth::noteOff"]
2737 [::core::mem::offset_of!(playdate_sound_synth, noteOff) - 80usize];
2738 ["Offset of field: playdate_sound_synth::stop"][::core::mem::offset_of!(playdate_sound_synth, stop) - 84usize];
2739 ["Offset of field: playdate_sound_synth::setVolume"]
2740 [::core::mem::offset_of!(playdate_sound_synth, setVolume) - 88usize];
2741 ["Offset of field: playdate_sound_synth::getVolume"]
2742 [::core::mem::offset_of!(playdate_sound_synth, getVolume) - 92usize];
2743 ["Offset of field: playdate_sound_synth::isPlaying"]
2744 [::core::mem::offset_of!(playdate_sound_synth, isPlaying) - 96usize];
2745 ["Offset of field: playdate_sound_synth::getEnvelope"]
2746 [::core::mem::offset_of!(playdate_sound_synth, getEnvelope) - 100usize];
2747 ["Offset of field: playdate_sound_synth::setWavetable"]
2748 [::core::mem::offset_of!(playdate_sound_synth, setWavetable) - 104usize];
2749 ["Offset of field: playdate_sound_synth::setGenerator"]
2750 [::core::mem::offset_of!(playdate_sound_synth, setGenerator) - 108usize];
2751 ["Offset of field: playdate_sound_synth::copy"]
2752 [::core::mem::offset_of!(playdate_sound_synth, copy) - 112usize];
2753 ["Offset of field: playdate_sound_synth::clearEnvelope"]
2754 [::core::mem::offset_of!(playdate_sound_synth, clearEnvelope) - 116usize];
2755};
2756#[repr(C)]
2757#[derive(Debug, Copy, Clone)]
2758#[must_use]
2759pub struct ControlSignal {
2760 _unused: [u8; 0],
2761}
2762#[repr(C)]
2763#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2764#[must_use]
2765pub struct playdate_control_signal {
2766 #[doc = "`ControlSignal* playdate->sound->controlsignal->newSignal(void)`\n\nCreates a new control signal object."]
2767 pub newSignal: ::core::option::Option<unsafe extern "C" fn() -> *mut ControlSignal>,
2768 #[doc = "`void playdate->sound->controlsignal->freeSignal(ControlSignal* signal)`\n\nFrees the given signal."]
2769 pub freeSignal: ::core::option::Option<unsafe extern "C" fn(signal: *mut ControlSignal)>,
2770 #[doc = "`void playdate->sound->controlsignal->clearEvents(ControlSignal* signal)`\n\nClears all events from the given signal."]
2771 pub clearEvents: ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal)>,
2772 #[doc = "`void playdate->sound->controlsignal->addEvent(ControlSignal* signal, int step, float value, int interpolate)`\n\nAdds a value to the signal’s timeline at the given step. If *interpolate* is set, the value is interpolated between the previous step+value and this one."]
2773 pub addEvent: ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal,
2774 step: core::ffi::c_int,
2775 value: core::ffi::c_float,
2776 interpolate: core::ffi::c_int)>,
2777 #[doc = "`void playdate->sound->controlsignal->removeEvent(ControlSignal* signal, int step)`\n\nRemoves the control event at the given step."]
2778 pub removeEvent:
2779 ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal, step: core::ffi::c_int)>,
2780 #[doc = "`int playdate->sound->controlsignal->getMIDIControllerNumber(ControlSignal* signal)`\n\nReturns the MIDI controller number for this ControlSignal, if it was created from a MIDI file via [playdate→sound→sequence→loadMIDIFile()](#f-sound.sequence.loadMIDIFile)."]
2781 pub getMIDIControllerNumber:
2782 ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal) -> core::ffi::c_int>,
2783}
2784#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2785const _: () = {
2786 ["Size of playdate_control_signal"][::core::mem::size_of::<playdate_control_signal>() - 24usize];
2787 ["Alignment of playdate_control_signal"][::core::mem::align_of::<playdate_control_signal>() - 4usize];
2788 ["Offset of field: playdate_control_signal::newSignal"]
2789 [::core::mem::offset_of!(playdate_control_signal, newSignal) - 0usize];
2790 ["Offset of field: playdate_control_signal::freeSignal"]
2791 [::core::mem::offset_of!(playdate_control_signal, freeSignal) - 4usize];
2792 ["Offset of field: playdate_control_signal::clearEvents"]
2793 [::core::mem::offset_of!(playdate_control_signal, clearEvents) - 8usize];
2794 ["Offset of field: playdate_control_signal::addEvent"]
2795 [::core::mem::offset_of!(playdate_control_signal, addEvent) - 12usize];
2796 ["Offset of field: playdate_control_signal::removeEvent"]
2797 [::core::mem::offset_of!(playdate_control_signal, removeEvent) - 16usize];
2798 ["Offset of field: playdate_control_signal::getMIDIControllerNumber"]
2799 [::core::mem::offset_of!(playdate_control_signal, getMIDIControllerNumber) - 20usize];
2800};
2801#[repr(C)]
2802#[derive(Debug, Copy, Clone)]
2803#[must_use]
2804pub struct PDSynthInstrument {
2805 _unused: [u8; 0],
2806}
2807#[repr(C)]
2808#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2809#[must_use]
2810pub struct playdate_sound_instrument {
2811 #[doc = "`PDSynthInstrument* playdate->sound->instrument->newInstrument(void)`\n\nCreates a new PDSynthInstrument object."]
2812 pub newInstrument: ::core::option::Option<unsafe extern "C" fn() -> *mut PDSynthInstrument>,
2813 #[doc = "`void playdate->sound->instrument->freeInstrument(PDSynthInstrument* instrument)`\n\nFrees the given instrument, first removing it from the sound engine if needed."]
2814 pub freeInstrument: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument)>,
2815 #[doc = "`int playdate->sound->instrument->addVoice(PDSynthInstrument* instrument, PDSynth* synth, MIDINote rangeStart, MIDINote rangeEnd, float transpose)`\n\nAdds the given [PDSynth](#C-sound.synth) to the instrument. The synth will respond to playNote events between *rangeState* and *rangeEnd*, inclusive. The *transpose* argument is in half-step units, and is added to the instrument’s [transpose](#f-sound.instrument.setTranspose) parameter. The function returns 1 if successful, or 0 if the synth is already in another instrument or channel."]
2816 pub addVoice: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2817 synth: *mut PDSynth,
2818 rangeStart: MIDINote,
2819 rangeEnd: MIDINote,
2820 transpose: core::ffi::c_float)
2821 -> core::ffi::c_int>,
2822 #[doc = "`PDSynth* playdate->sound->instrument->playNote(PDSynthInstrument* instrument, float frequency, float vel, float len, uint32_t when)`"]
2823 pub playNote: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2824 frequency: core::ffi::c_float,
2825 vel: core::ffi::c_float,
2826 len: core::ffi::c_float,
2827 when: u32)
2828 -> *mut PDSynth>,
2829 #[doc = "`PDSynth* playdate->sound->instrument->playMIDINote(PDSynthInstrument* instrument, MIDINote note, float vel, float len, uint32_t when)`\n\nThe instrument passes the playNote/playMIDINote() event to the synth in its collection that has been off for the longest, or has been playing longest if all synths are currently playing. See also [playdate→sound→synth→playNote()](#f-sound.synth.playNote). The PDSynth that received the playNote event is returned."]
2830 pub playMIDINote: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2831 note: MIDINote,
2832 vel: core::ffi::c_float,
2833 len: core::ffi::c_float,
2834 when: u32)
2835 -> *mut PDSynth>,
2836 #[doc = "`void playdate->sound->instrument->setPitchBend(PDSynthInstrument* instrument, float amount)`\n\nSets the pitch bend to be applied to the voices in the instrument, as a fraction of the full range."]
2837 pub setPitchBend:
2838 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, bend: core::ffi::c_float)>,
2839 #[doc = "`void playdate->sound->instrument->setPitchBendRange(PDSynthInstrument* instrument, float halfSteps)`\n\nSets the pitch bend range for the voices in the instrument. The default range is 12, for a full octave."]
2840 pub setPitchBendRange:
2841 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, halfSteps: core::ffi::c_float)>,
2842 #[doc = "`void playdate->sound->instrument->setTranspose(PDSynthInstrument* instrument, float halfSteps)`\n\nSets the transpose parameter for all voices in the instrument."]
2843 pub setTranspose:
2844 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, halfSteps: core::ffi::c_float)>,
2845 #[doc = "`void playdate->sound->instrument->noteOff(PDSynthInstrument* instrument, MIDINote note, uint32_t when)`\n\nForwards the noteOff() event to the synth currently playing the given note. See also [playdate→sound→synth→noteOff()](#f-sound.synth.noteOff)."]
2846 pub noteOff:
2847 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, note: MIDINote, when: u32)>,
2848 #[doc = "`void playdate->sound->instrument->allNotesOff(PDSynthInstrument* instrument, uint32_t when)`\n\nSends a noteOff event to all voices in the instrument."]
2849 pub allNotesOff: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, when: u32)>,
2850 #[doc = "`void playdate->sound->instrument->setVolume(PDSynthInstrument* instrument, float lvol, float rvol)`"]
2851 pub setVolume: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2852 left: core::ffi::c_float,
2853 right: core::ffi::c_float)>,
2854 #[doc = "`void playdate->sound->instrument->getVolume(PDSynthInstrument* instrument, float* outlvol, float* outrvol)`\n\nSets and gets the playback volume (0.0 - 1.0) for left and right channels of the synth. This is equivalent to\n\n```cpp\nplaydate->sound->source->setVolume((SoundSource*)instrument, lvol, rvol);\nplaydate->sound->source->getVolume((SoundSource*)instrument, &lvol, &rvol);\n```"]
2855 pub getVolume: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2856 left: *mut core::ffi::c_float,
2857 right: *mut core::ffi::c_float)>,
2858 #[doc = "`int playdate->sound->instrument->activeVoiceCount(PDSynthInstrument* instrument)`\n\nReturns the number of voices in the instrument currently playing."]
2859 pub activeVoiceCount:
2860 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument) -> core::ffi::c_int>,
2861}
2862#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2863const _: () = {
2864 ["Size of playdate_sound_instrument"][::core::mem::size_of::<playdate_sound_instrument>() - 52usize];
2865 ["Alignment of playdate_sound_instrument"][::core::mem::align_of::<playdate_sound_instrument>() - 4usize];
2866 ["Offset of field: playdate_sound_instrument::newInstrument"]
2867 [::core::mem::offset_of!(playdate_sound_instrument, newInstrument) - 0usize];
2868 ["Offset of field: playdate_sound_instrument::freeInstrument"]
2869 [::core::mem::offset_of!(playdate_sound_instrument, freeInstrument) - 4usize];
2870 ["Offset of field: playdate_sound_instrument::addVoice"]
2871 [::core::mem::offset_of!(playdate_sound_instrument, addVoice) - 8usize];
2872 ["Offset of field: playdate_sound_instrument::playNote"]
2873 [::core::mem::offset_of!(playdate_sound_instrument, playNote) - 12usize];
2874 ["Offset of field: playdate_sound_instrument::playMIDINote"]
2875 [::core::mem::offset_of!(playdate_sound_instrument, playMIDINote) - 16usize];
2876 ["Offset of field: playdate_sound_instrument::setPitchBend"]
2877 [::core::mem::offset_of!(playdate_sound_instrument, setPitchBend) - 20usize];
2878 ["Offset of field: playdate_sound_instrument::setPitchBendRange"]
2879 [::core::mem::offset_of!(playdate_sound_instrument, setPitchBendRange) - 24usize];
2880 ["Offset of field: playdate_sound_instrument::setTranspose"]
2881 [::core::mem::offset_of!(playdate_sound_instrument, setTranspose) - 28usize];
2882 ["Offset of field: playdate_sound_instrument::noteOff"]
2883 [::core::mem::offset_of!(playdate_sound_instrument, noteOff) - 32usize];
2884 ["Offset of field: playdate_sound_instrument::allNotesOff"]
2885 [::core::mem::offset_of!(playdate_sound_instrument, allNotesOff) - 36usize];
2886 ["Offset of field: playdate_sound_instrument::setVolume"]
2887 [::core::mem::offset_of!(playdate_sound_instrument, setVolume) - 40usize];
2888 ["Offset of field: playdate_sound_instrument::getVolume"]
2889 [::core::mem::offset_of!(playdate_sound_instrument, getVolume) - 44usize];
2890 ["Offset of field: playdate_sound_instrument::activeVoiceCount"]
2891 [::core::mem::offset_of!(playdate_sound_instrument, activeVoiceCount) - 48usize];
2892};
2893#[repr(C)]
2894#[derive(Debug, Copy, Clone)]
2895#[must_use]
2896pub struct SequenceTrack {
2897 _unused: [u8; 0],
2898}
2899#[repr(C)]
2900#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2901#[must_use]
2902pub struct playdate_sound_track {
2903 #[doc = "`SequenceTrack* playdate->sound->track->newTrack(void)`\n\nReturns a new SequenceTrack."]
2904 pub newTrack: ::core::option::Option<unsafe extern "C" fn() -> *mut SequenceTrack>,
2905 #[doc = "`void playdate->sound->track->freeTrack(SequenceTrack* track)`\n\nFrees the SequenceTrack."]
2906 pub freeTrack: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2907 #[doc = "`void playdate->sound->track->setInstrument(SequenceTrack* track, PDSynthInstrument* instrument)`"]
2908 pub setInstrument:
2909 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, inst: *mut PDSynthInstrument)>,
2910 #[doc = "`PDSynthInstrument* playdate->sound->track->getInstrument(SequenceTrack* track)`\n\nSets or gets the [PDSynthInstrument](#C-sound.PDSynthInstrument) assigned to the track."]
2911 pub getInstrument:
2912 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> *mut PDSynthInstrument>,
2913 #[doc = "`void playdate->sound->track->addNoteEvent(SequenceTrack* track, uint32_t step, uint32_t length, MIDINote note, float vel)`\n\nAdds a single note event to the track."]
2914 pub addNoteEvent: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2915 step: u32,
2916 len: u32,
2917 note: MIDINote,
2918 velocity: core::ffi::c_float)>,
2919 #[doc = "`void playdate->sound->track->removeNoteEvent(SequenceTrack* track, uint32_t step, MIDINote note)`\n\nRemoves the event at *step* playing *note*."]
2920 pub removeNoteEvent:
2921 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, step: u32, note: MIDINote)>,
2922 #[doc = "`void playdate->sound->track->clearNotes(SequenceTrack* track)`\n\nClears all notes from the track."]
2923 pub clearNotes: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2924 #[doc = "`void playdate->sound->track->getControlSignalCount(SequenceTrack* track)`\n\nReturns the number of [ControlSignal](#C-sound.ControlSignal) objects in the track."]
2925 pub getControlSignalCount:
2926 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2927 #[doc = "`void playdate->sound->track->getControlSignal(SequenceTrack* track, int idx)`\n\nReturns the [ControlSignal](#C-sound.ControlSignal) at index *idx*."]
2928 pub getControlSignal: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2929 idx: core::ffi::c_int)
2930 -> *mut ControlSignal>,
2931 #[doc = "`void playdate->sound->track->clearControlEvents(SequenceTrack* track)`\n\nClears all [ControlSignals](#C-sound.ControlSignal) from the track."]
2932 pub clearControlEvents: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2933 #[doc = "`int playdate->sound->track->getPolyphony(SequenceTrack* track)`\n\nReturns the maximum number of simultaneously playing notes in the track. (Currently, this value is only set when the track was loaded from a MIDI file. We don’t yet track polyphony for user-created events.)"]
2934 pub getPolyphony: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2935 #[doc = "`int playdate->sound->track->activeVoiceCount(SequenceTrack* track)`\n\nReturns the number of voices currently playing in the track’s instrument."]
2936 pub activeVoiceCount:
2937 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2938 #[doc = "`void playdate->sound->track->setMuted(SequenceTrack* track, int mute)`\n\nMutes or unmutes the track."]
2939 pub setMuted: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, mute: core::ffi::c_int)>,
2940 #[doc = "`int playdate->sound->track->getLength(SequenceTrack* track)`\n\nReturns the length, in steps, of the track—\u{200b}that is, the step where the last note in the track ends."]
2941 pub getLength: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> u32>,
2942 #[doc = "`int playdate->sound->track->getIndexForStep(SequenceTrack* track, uint32_t step)`\n\nReturns the internal array index for the first note at the given step."]
2943 pub getIndexForStep:
2944 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, step: u32) -> core::ffi::c_int>,
2945 #[doc = "`int playdate->sound->track->getNoteAtIndex(SequenceTrack* track, int index, uint32_t* outStep, uint32_t* outLen, MIDINote* outNote, float* outVelocity)`\n\nIf the given index is in range, sets the data in the out pointers and returns 1; otherwise, returns 0."]
2946 pub getNoteAtIndex: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2947 index: core::ffi::c_int,
2948 outStep: *mut u32,
2949 outLen: *mut u32,
2950 outNote: *mut MIDINote,
2951 outVelocity: *mut core::ffi::c_float)
2952 -> core::ffi::c_int>,
2953 #[doc = "`void playdate->sound->track->getSignalForController(SequenceTrack* track, int controller, int create)`\n\nReturns the [ControlSignal](#C-sound.ControlSignal) for MIDI controller number *controller*, creating it if the **create** flag is set and it doesn’t yet exist."]
2954 pub getSignalForController: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2955 controller: core::ffi::c_int,
2956 create: core::ffi::c_int)
2957 -> *mut ControlSignal>,
2958}
2959#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2960const _: () = {
2961 ["Size of playdate_sound_track"][::core::mem::size_of::<playdate_sound_track>() - 68usize];
2962 ["Alignment of playdate_sound_track"][::core::mem::align_of::<playdate_sound_track>() - 4usize];
2963 ["Offset of field: playdate_sound_track::newTrack"]
2964 [::core::mem::offset_of!(playdate_sound_track, newTrack) - 0usize];
2965 ["Offset of field: playdate_sound_track::freeTrack"]
2966 [::core::mem::offset_of!(playdate_sound_track, freeTrack) - 4usize];
2967 ["Offset of field: playdate_sound_track::setInstrument"]
2968 [::core::mem::offset_of!(playdate_sound_track, setInstrument) - 8usize];
2969 ["Offset of field: playdate_sound_track::getInstrument"]
2970 [::core::mem::offset_of!(playdate_sound_track, getInstrument) - 12usize];
2971 ["Offset of field: playdate_sound_track::addNoteEvent"]
2972 [::core::mem::offset_of!(playdate_sound_track, addNoteEvent) - 16usize];
2973 ["Offset of field: playdate_sound_track::removeNoteEvent"]
2974 [::core::mem::offset_of!(playdate_sound_track, removeNoteEvent) - 20usize];
2975 ["Offset of field: playdate_sound_track::clearNotes"]
2976 [::core::mem::offset_of!(playdate_sound_track, clearNotes) - 24usize];
2977 ["Offset of field: playdate_sound_track::getControlSignalCount"]
2978 [::core::mem::offset_of!(playdate_sound_track, getControlSignalCount) - 28usize];
2979 ["Offset of field: playdate_sound_track::getControlSignal"]
2980 [::core::mem::offset_of!(playdate_sound_track, getControlSignal) - 32usize];
2981 ["Offset of field: playdate_sound_track::clearControlEvents"]
2982 [::core::mem::offset_of!(playdate_sound_track, clearControlEvents) - 36usize];
2983 ["Offset of field: playdate_sound_track::getPolyphony"]
2984 [::core::mem::offset_of!(playdate_sound_track, getPolyphony) - 40usize];
2985 ["Offset of field: playdate_sound_track::activeVoiceCount"]
2986 [::core::mem::offset_of!(playdate_sound_track, activeVoiceCount) - 44usize];
2987 ["Offset of field: playdate_sound_track::setMuted"]
2988 [::core::mem::offset_of!(playdate_sound_track, setMuted) - 48usize];
2989 ["Offset of field: playdate_sound_track::getLength"]
2990 [::core::mem::offset_of!(playdate_sound_track, getLength) - 52usize];
2991 ["Offset of field: playdate_sound_track::getIndexForStep"]
2992 [::core::mem::offset_of!(playdate_sound_track, getIndexForStep) - 56usize];
2993 ["Offset of field: playdate_sound_track::getNoteAtIndex"]
2994 [::core::mem::offset_of!(playdate_sound_track, getNoteAtIndex) - 60usize];
2995 ["Offset of field: playdate_sound_track::getSignalForController"]
2996 [::core::mem::offset_of!(playdate_sound_track, getSignalForController) - 64usize];
2997};
2998#[repr(C)]
2999#[derive(Debug, Copy, Clone)]
3000#[must_use]
3001pub struct SoundSequence {
3002 _unused: [u8; 0],
3003}
3004pub type SequenceFinishedCallback =
3005 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, userdata: *mut core::ffi::c_void)>;
3006#[repr(C)]
3007#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3008#[must_use]
3009pub struct playdate_sound_sequence {
3010 #[doc = "`SoundSequence* playdate->sound->sequence->newSequence(void)`"]
3011 pub newSequence: ::core::option::Option<unsafe extern "C" fn() -> *mut SoundSequence>,
3012 #[doc = "`void playdate->sound->sequence->freeSequence(SoundSequence* sequence)`\n\nCreates or destroys a SoundSequence object."]
3013 pub freeSequence: ::core::option::Option<unsafe extern "C" fn(sequence: *mut SoundSequence)>,
3014 #[doc = "`int playdate->sound->sequence->loadMIDIFile(SoundSequence* sequence, const char* path)`\n\nIf the sequence is empty, attempts to load data from the MIDI file at *path* into the sequence. Returns 1 on success, 0 on failure."]
3015 pub loadMIDIFile: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3016 path: *const core::ffi::c_char)
3017 -> core::ffi::c_int>,
3018 #[doc = "`uint32_t playdate->sound->sequence->getTime(SoundSequence* sequence)`"]
3019 pub getTime: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> u32>,
3020 #[doc = "`void playdate->sound->sequence->setTime(SoundSequence* sequence, uint32_t time)`\n\nGets or sets the current time in the sequence, in samples since the start of the file. Note that which step this moves the sequence to depends on the current tempo."]
3021 pub setTime: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, time: u32)>,
3022 #[doc = "`void playdate->sound->sequence->setLoops(SoundSequence* sequence, int startstep, int endstep, int loops)`\n\nSets the looping range of the sequence. If *loops* is 0, the loop repeats endlessly."]
3023 pub setLoops: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3024 loopstart: core::ffi::c_int,
3025 loopend: core::ffi::c_int,
3026 loops: core::ffi::c_int)>,
3027 pub getTempo_deprecated:
3028 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3029 #[doc = "`void playdate->sound->sequence->setTempo(SoundSequence* sequence, float stepsPerSecond)`\n\nSets or gets the tempo of the sequence, in steps per second."]
3030 pub setTempo:
3031 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, stepsPerSecond: core::ffi::c_float)>,
3032 #[doc = "`int playdate->sound->sequence->getTrackCount(SoundSequence* sequence)`\n\nReturns the number of tracks in the sequence."]
3033 pub getTrackCount: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3034 #[doc = "`SequenceTrack* playdate->sound->sequence->addTrack(SoundSequence* sequence)`\n\nAdds the given [playdate.sound.track](#C-sound.track) to the sequence."]
3035 pub addTrack: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> *mut SequenceTrack>,
3036 #[doc = "`SequenceTrack* playdate->sound->sequence->getTrackAtIndex(SoundSequence* sequence, unsigned int idx)`"]
3037 pub getTrackAtIndex: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3038 track: core::ffi::c_uint)
3039 -> *mut SequenceTrack>,
3040 #[doc = "`void playdate->sound->sequence->setTrackAtIndex(SoundSequence* sequence, SequenceTrack* track, unsigned int idx)`\n\nSets or gets the given [SoundTrack](#C-sound.track) object at position *idx* in the sequence."]
3041 pub setTrackAtIndex: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3042 track: *mut SequenceTrack,
3043 idx: core::ffi::c_uint)>,
3044 #[doc = "`void playdate->sound->sequence->allNotesOff(SoundSequence* sequence)`\n\nSends a stop signal to all playing notes on all tracks."]
3045 pub allNotesOff: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence)>,
3046 #[doc = "`int playdate->sound->sequence->isPlaying(SoundSequence* sequence)`\n\nReturns 1 if the sequence is currently playing, otherwise 0."]
3047 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3048 #[doc = "`int playdate->sound->sequence->getLength(SoundSequence* sequence)`\n\nReturns the length of the longest track in the sequence, in steps. See also [playdate.sound.track.getLength()](#m-sound.track:getLength)."]
3049 pub getLength: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> u32>,
3050 #[doc = "`void playdate->sound->sequence->play(SoundSequence* sequence, SequenceFinishedCallback finishCallback, void* userdata)`"]
3051 pub play: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3052 finishCallback: SequenceFinishedCallback,
3053 userdata: *mut core::ffi::c_void)>,
3054 #[doc = "`void playdate->sound->sequence->stop(SoundSequence* sequence)`\n\nStarts or stops playing the sequence. `finishCallback` is an optional function to be called when the sequence finishes playing or is stopped.\n\nSequenceFinishedCallback\n\n```cpp\ntypedef void (*SequenceFinishedCallback)(SoundSequence* seq, void* userdata);\n```"]
3055 pub stop: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence)>,
3056 #[doc = "`int playdate->sound->sequence->getCurrentStep(SoundSequence* sequence, int* timeOffset)`\n\nReturns the step number the sequence is currently at. If *timeOffset* is not NULL, its contents are set to the current sample offset within the step."]
3057 pub getCurrentStep: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3058 timeOffset: *mut core::ffi::c_int)
3059 -> core::ffi::c_int>,
3060 #[doc = "`void playdate->sound->sequence->setCurrentStep(SoundSequence* seq, int step, int timeOffset, int playNotes)`\n\nSet the current step for the sequence. *timeOffset* is a sample offset within the step. If *playNotes* is set, notes at the given step (ignoring *timeOffset*) are played."]
3061 pub setCurrentStep: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3062 step: core::ffi::c_int,
3063 timeOffset: core::ffi::c_int,
3064 playNotes: core::ffi::c_int)>,
3065 #[doc = "`float playdate->sound->sequence->getTempo(SoundSequence* sequence)`"]
3066 pub getTempo: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_float>,
3067}
3068#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3069const _: () = {
3070 ["Size of playdate_sound_sequence"][::core::mem::size_of::<playdate_sound_sequence>() - 80usize];
3071 ["Alignment of playdate_sound_sequence"][::core::mem::align_of::<playdate_sound_sequence>() - 4usize];
3072 ["Offset of field: playdate_sound_sequence::newSequence"]
3073 [::core::mem::offset_of!(playdate_sound_sequence, newSequence) - 0usize];
3074 ["Offset of field: playdate_sound_sequence::freeSequence"]
3075 [::core::mem::offset_of!(playdate_sound_sequence, freeSequence) - 4usize];
3076 ["Offset of field: playdate_sound_sequence::loadMIDIFile"]
3077 [::core::mem::offset_of!(playdate_sound_sequence, loadMIDIFile) - 8usize];
3078 ["Offset of field: playdate_sound_sequence::getTime"]
3079 [::core::mem::offset_of!(playdate_sound_sequence, getTime) - 12usize];
3080 ["Offset of field: playdate_sound_sequence::setTime"]
3081 [::core::mem::offset_of!(playdate_sound_sequence, setTime) - 16usize];
3082 ["Offset of field: playdate_sound_sequence::setLoops"]
3083 [::core::mem::offset_of!(playdate_sound_sequence, setLoops) - 20usize];
3084 ["Offset of field: playdate_sound_sequence::getTempo_deprecated"]
3085 [::core::mem::offset_of!(playdate_sound_sequence, getTempo_deprecated) - 24usize];
3086 ["Offset of field: playdate_sound_sequence::setTempo"]
3087 [::core::mem::offset_of!(playdate_sound_sequence, setTempo) - 28usize];
3088 ["Offset of field: playdate_sound_sequence::getTrackCount"]
3089 [::core::mem::offset_of!(playdate_sound_sequence, getTrackCount) - 32usize];
3090 ["Offset of field: playdate_sound_sequence::addTrack"]
3091 [::core::mem::offset_of!(playdate_sound_sequence, addTrack) - 36usize];
3092 ["Offset of field: playdate_sound_sequence::getTrackAtIndex"]
3093 [::core::mem::offset_of!(playdate_sound_sequence, getTrackAtIndex) - 40usize];
3094 ["Offset of field: playdate_sound_sequence::setTrackAtIndex"]
3095 [::core::mem::offset_of!(playdate_sound_sequence, setTrackAtIndex) - 44usize];
3096 ["Offset of field: playdate_sound_sequence::allNotesOff"]
3097 [::core::mem::offset_of!(playdate_sound_sequence, allNotesOff) - 48usize];
3098 ["Offset of field: playdate_sound_sequence::isPlaying"]
3099 [::core::mem::offset_of!(playdate_sound_sequence, isPlaying) - 52usize];
3100 ["Offset of field: playdate_sound_sequence::getLength"]
3101 [::core::mem::offset_of!(playdate_sound_sequence, getLength) - 56usize];
3102 ["Offset of field: playdate_sound_sequence::play"]
3103 [::core::mem::offset_of!(playdate_sound_sequence, play) - 60usize];
3104 ["Offset of field: playdate_sound_sequence::stop"]
3105 [::core::mem::offset_of!(playdate_sound_sequence, stop) - 64usize];
3106 ["Offset of field: playdate_sound_sequence::getCurrentStep"]
3107 [::core::mem::offset_of!(playdate_sound_sequence, getCurrentStep) - 68usize];
3108 ["Offset of field: playdate_sound_sequence::setCurrentStep"]
3109 [::core::mem::offset_of!(playdate_sound_sequence, setCurrentStep) - 72usize];
3110 ["Offset of field: playdate_sound_sequence::getTempo"]
3111 [::core::mem::offset_of!(playdate_sound_sequence, getTempo) - 76usize];
3112};
3113#[repr(C)]
3114#[derive(Debug, Copy, Clone)]
3115#[must_use]
3116pub struct TwoPoleFilter {
3117 _unused: [u8; 0],
3118}
3119#[repr(u8)]
3120#[must_use]
3121#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3122pub enum TwoPoleFilterType {
3123 kFilterTypeLowPass = 0,
3124 kFilterTypeHighPass = 1,
3125 kFilterTypeBandPass = 2,
3126 kFilterTypeNotch = 3,
3127 kFilterTypePEQ = 4,
3128 kFilterTypeLowShelf = 5,
3129 kFilterTypeHighShelf = 6,
3130}
3131#[repr(C)]
3132#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3133#[must_use]
3134pub struct playdate_sound_effect_twopolefilter {
3135 #[doc = "`TwoPoleFilter* playdate->sound->effect->twopolefilter->newFilter(void)`\n\nCreates a new two pole filter effect."]
3136 pub newFilter: ::core::option::Option<unsafe extern "C" fn() -> *mut TwoPoleFilter>,
3137 #[doc = "`void playdate->sound->effect->twopolefilter->freeFilter(TwoPoleFilter* filter)`\n\nFrees the given filter."]
3138 pub freeFilter: ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter)>,
3139 #[doc = "`void playdate->sound->effect->twopolefilter->setType(TwoPoleFilter* filter, TwoPoleFilterType type)`\n\nTwoPoleFilterType\n\n```cpp\ntypedef enum\n{\n\tkFilterTypeLowPass,\n\tkFilterTypeHighPass,\n\tkFilterTypeBandPass,\n\tkFilterTypeNotch,\n\tkFilterTypePEQ,\n\tkFilterTypeLowShelf,\n\tkFilterTypeHighShelf\n} TwoPoleFilterType;\n```\n\nSets the type of the filter."]
3140 pub setType:
3141 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, type_: TwoPoleFilterType)>,
3142 #[doc = "`void playdate->sound->effect->twopolefilter->setFrequency(TwoPoleFilter* filter, float frequency)`\n\nSets the center/corner frequency of the filter. Value is in Hz."]
3143 pub setFrequency:
3144 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, frequency: core::ffi::c_float)>,
3145 #[doc = "`void playdate->sound->effect->twopolefilter->setFrequencyModulator(TwoPoleFilter* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the effect’s frequency. The signal is scaled so that a value of 1.0 corresponds to half the sample rate. Set to *NULL* to clear the modulator."]
3146 pub setFrequencyModulator:
3147 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, signal: *mut PDSynthSignalValue)>,
3148 #[doc = "`PDSynthSignalValue* playdate->sound->effect->twopolefilter->getFrequencyModulator(TwoPoleFilter* filter)`\n\nReturns the filter’s current frequency modulator."]
3149 pub getFrequencyModulator:
3150 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter) -> *mut PDSynthSignalValue>,
3151 #[doc = "`void playdate->sound->effect->twopolefilter->setGain(TwoPoleFilter* filter, float gain)`\n\nSets the filter gain."]
3152 pub setGain:
3153 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, gain: core::ffi::c_float)>,
3154 #[doc = "`void playdate->sound->effect->twopolefilter->setResonance(TwoPoleFilter* filter, float resonance)`\n\nSets the filter resonance."]
3155 pub setResonance:
3156 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, resonance: core::ffi::c_float)>,
3157 #[doc = "`void playdate->sound->effect->twopolefilter->setResonanceModulator(TwoPoleFilter* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the filter resonance. Set to *NULL* to clear the modulator."]
3158 pub setResonanceModulator:
3159 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, signal: *mut PDSynthSignalValue)>,
3160 #[doc = "`PDSynthSignalValue* playdate->sound->effect->twopolefilter->getResonanceModulator(TwoPoleFilter* filter)`\n\nReturns the filter’s current resonance modulator."]
3161 pub getResonanceModulator:
3162 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter) -> *mut PDSynthSignalValue>,
3163}
3164#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3165const _: () = {
3166 ["Size of playdate_sound_effect_twopolefilter"]
3167 [::core::mem::size_of::<playdate_sound_effect_twopolefilter>() - 40usize];
3168 ["Alignment of playdate_sound_effect_twopolefilter"]
3169 [::core::mem::align_of::<playdate_sound_effect_twopolefilter>() - 4usize];
3170 ["Offset of field: playdate_sound_effect_twopolefilter::newFilter"]
3171 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, newFilter) - 0usize];
3172 ["Offset of field: playdate_sound_effect_twopolefilter::freeFilter"]
3173 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, freeFilter) - 4usize];
3174 ["Offset of field: playdate_sound_effect_twopolefilter::setType"]
3175 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setType) - 8usize];
3176 ["Offset of field: playdate_sound_effect_twopolefilter::setFrequency"]
3177 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setFrequency) - 12usize];
3178 ["Offset of field: playdate_sound_effect_twopolefilter::setFrequencyModulator"]
3179 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setFrequencyModulator) - 16usize];
3180 ["Offset of field: playdate_sound_effect_twopolefilter::getFrequencyModulator"]
3181 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, getFrequencyModulator) - 20usize];
3182 ["Offset of field: playdate_sound_effect_twopolefilter::setGain"]
3183 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setGain) - 24usize];
3184 ["Offset of field: playdate_sound_effect_twopolefilter::setResonance"]
3185 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setResonance) - 28usize];
3186 ["Offset of field: playdate_sound_effect_twopolefilter::setResonanceModulator"]
3187 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setResonanceModulator) - 32usize];
3188 ["Offset of field: playdate_sound_effect_twopolefilter::getResonanceModulator"]
3189 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, getResonanceModulator) - 36usize];
3190};
3191#[repr(C)]
3192#[derive(Debug, Copy, Clone)]
3193#[must_use]
3194pub struct OnePoleFilter {
3195 _unused: [u8; 0],
3196}
3197#[repr(C)]
3198#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3199#[must_use]
3200pub struct playdate_sound_effect_onepolefilter {
3201 #[doc = "`OnePoleFilter* playdate->sound->effect->onepolefilter->newFilter(void)`\n\nCreates a new one pole filter."]
3202 pub newFilter: ::core::option::Option<unsafe extern "C" fn() -> *mut OnePoleFilter>,
3203 #[doc = "`void playdate->sound->effect->onepolefilter->freeFilter(OnePoleFilter* filter)`\n\nFrees the filter."]
3204 pub freeFilter: ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter)>,
3205 #[doc = "`void playdate->sound->effect->onepolefilter->setParameter(OnePoleFilter* filter, float parameter)`\n\nSets the filter’s single parameter (cutoff frequency) to *p*. Values above 0 (up to 1) are high-pass, values below 0 (down to -1) are low-pass."]
3206 pub setParameter:
3207 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter, parameter: core::ffi::c_float)>,
3208 #[doc = "`void playdate->sound->effect->onepolefilter->setParameterModulator(OnePoleFilter* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the filter parameter. Set to *NULL* to clear the modulator."]
3209 pub setParameterModulator:
3210 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter, signal: *mut PDSynthSignalValue)>,
3211 #[doc = "`PDSynthSignalValue* playdate->sound->effect->onepolefilter->getParameterModulator(OnePoleFilter* filter)`\n\nReturns the filter’s current parameter modulator."]
3212 pub getParameterModulator:
3213 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter) -> *mut PDSynthSignalValue>,
3214}
3215#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3216const _: () = {
3217 ["Size of playdate_sound_effect_onepolefilter"]
3218 [::core::mem::size_of::<playdate_sound_effect_onepolefilter>() - 20usize];
3219 ["Alignment of playdate_sound_effect_onepolefilter"]
3220 [::core::mem::align_of::<playdate_sound_effect_onepolefilter>() - 4usize];
3221 ["Offset of field: playdate_sound_effect_onepolefilter::newFilter"]
3222 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, newFilter) - 0usize];
3223 ["Offset of field: playdate_sound_effect_onepolefilter::freeFilter"]
3224 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, freeFilter) - 4usize];
3225 ["Offset of field: playdate_sound_effect_onepolefilter::setParameter"]
3226 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, setParameter) - 8usize];
3227 ["Offset of field: playdate_sound_effect_onepolefilter::setParameterModulator"]
3228 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, setParameterModulator) - 12usize];
3229 ["Offset of field: playdate_sound_effect_onepolefilter::getParameterModulator"]
3230 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, getParameterModulator) - 16usize];
3231};
3232#[repr(C)]
3233#[derive(Debug, Copy, Clone)]
3234#[must_use]
3235pub struct BitCrusher {
3236 _unused: [u8; 0],
3237}
3238#[repr(C)]
3239#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3240#[must_use]
3241pub struct playdate_sound_effect_bitcrusher {
3242 #[doc = "`BitCrusher* playdate->sound->effect->bitcrusher->newBitCrusher(void)`\n\nReturns a new BitCrusher effect."]
3243 pub newBitCrusher: ::core::option::Option<unsafe extern "C" fn() -> *mut BitCrusher>,
3244 #[doc = "`void playdate->sound->effect->bitcrusher->freeBitCrusher(BitCrusher* filter)`\n\nFrees the given effect."]
3245 pub freeBitCrusher: ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher)>,
3246 #[doc = "`void playdate->sound->effect->bitcrusher->setAmount(BitCrusher* filter, float amount)`\n\nSets the amount of crushing to *amount*. Valid values are 0 (no effect) to 1 (quantizing output to 1-bit)."]
3247 pub setAmount:
3248 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, amount: core::ffi::c_float)>,
3249 #[doc = "`void playdate->sound->effect->bitcrusher->setAmountModulator(BitCrusher* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the crushing amount. Set to *NULL* to clear the modulator."]
3250 pub setAmountModulator:
3251 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, signal: *mut PDSynthSignalValue)>,
3252 #[doc = "`PDSynthSignalValue* playdate->sound->effect->bitcrusher->getAmountModulator(BitCrusher* filter)`\n\nReturns the currently set modulator."]
3253 pub getAmountModulator:
3254 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher) -> *mut PDSynthSignalValue>,
3255 #[doc = "`void playdate->sound->effect->bitcrusher->setUndersampling(BitCrusher* filter, float undersample)`\n\nSets the number of samples to repeat, quantizing the input in time. A value of 0 produces no undersampling, 1 repeats every other sample, etc."]
3256 pub setUndersampling:
3257 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, undersampling: core::ffi::c_float)>,
3258 #[doc = "`void playdate->sound->effect->bitcrusher->setUndersampleModulator(BitCrusher* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the undersampling amount. Set to *NULL* to clear the modulator."]
3259 pub setUndersampleModulator:
3260 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, signal: *mut PDSynthSignalValue)>,
3261 #[doc = "`PDSynthSignalValue* playdate->sound->effect->bitcrusher->getUndersampleModulator(BitCrusher* filter)`\n\nReturns the currently set modulator."]
3262 pub getUndersampleModulator:
3263 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher) -> *mut PDSynthSignalValue>,
3264}
3265#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3266const _: () = {
3267 ["Size of playdate_sound_effect_bitcrusher"]
3268 [::core::mem::size_of::<playdate_sound_effect_bitcrusher>() - 32usize];
3269 ["Alignment of playdate_sound_effect_bitcrusher"]
3270 [::core::mem::align_of::<playdate_sound_effect_bitcrusher>() - 4usize];
3271 ["Offset of field: playdate_sound_effect_bitcrusher::newBitCrusher"]
3272 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, newBitCrusher) - 0usize];
3273 ["Offset of field: playdate_sound_effect_bitcrusher::freeBitCrusher"]
3274 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, freeBitCrusher) - 4usize];
3275 ["Offset of field: playdate_sound_effect_bitcrusher::setAmount"]
3276 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setAmount) - 8usize];
3277 ["Offset of field: playdate_sound_effect_bitcrusher::setAmountModulator"]
3278 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setAmountModulator) - 12usize];
3279 ["Offset of field: playdate_sound_effect_bitcrusher::getAmountModulator"]
3280 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, getAmountModulator) - 16usize];
3281 ["Offset of field: playdate_sound_effect_bitcrusher::setUndersampling"]
3282 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setUndersampling) - 20usize];
3283 ["Offset of field: playdate_sound_effect_bitcrusher::setUndersampleModulator"]
3284 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setUndersampleModulator) - 24usize];
3285 ["Offset of field: playdate_sound_effect_bitcrusher::getUndersampleModulator"]
3286 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, getUndersampleModulator) - 28usize];
3287};
3288#[repr(C)]
3289#[derive(Debug, Copy, Clone)]
3290#[must_use]
3291pub struct RingModulator {
3292 _unused: [u8; 0],
3293}
3294#[repr(C)]
3295#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3296#[must_use]
3297pub struct playdate_sound_effect_ringmodulator {
3298 #[doc = "`RingModulator* playdate->sound->effect->ringmodulator->newRingmod(void)`\n\nReturns a new ring modulator effect."]
3299 pub newRingmod: ::core::option::Option<unsafe extern "C" fn() -> *mut RingModulator>,
3300 pub freeRingmod: ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator)>,
3301 #[doc = "`void playdate->sound->effect->ringmodulator->setFrequency(RingModulator* filter, float frequency)`\n\nSets the frequency of the modulation signal."]
3302 pub setFrequency:
3303 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator, frequency: core::ffi::c_float)>,
3304 #[doc = "`void playdate->sound->effect->ringmodulator->setFrequencyModulator(RingModulator* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the frequency of the ring modulator. Set to *NULL* to clear the modulator."]
3305 pub setFrequencyModulator:
3306 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator, signal: *mut PDSynthSignalValue)>,
3307 #[doc = "`PDSynthSignalValue* playdate->sound->effect->ringmodulator->getFrequencyModulator(RingModulator* filter)`\n\nReturns the currently set frequency modulator."]
3308 pub getFrequencyModulator:
3309 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator) -> *mut PDSynthSignalValue>,
3310}
3311#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3312const _: () = {
3313 ["Size of playdate_sound_effect_ringmodulator"]
3314 [::core::mem::size_of::<playdate_sound_effect_ringmodulator>() - 20usize];
3315 ["Alignment of playdate_sound_effect_ringmodulator"]
3316 [::core::mem::align_of::<playdate_sound_effect_ringmodulator>() - 4usize];
3317 ["Offset of field: playdate_sound_effect_ringmodulator::newRingmod"]
3318 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, newRingmod) - 0usize];
3319 ["Offset of field: playdate_sound_effect_ringmodulator::freeRingmod"]
3320 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, freeRingmod) - 4usize];
3321 ["Offset of field: playdate_sound_effect_ringmodulator::setFrequency"]
3322 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, setFrequency) - 8usize];
3323 ["Offset of field: playdate_sound_effect_ringmodulator::setFrequencyModulator"]
3324 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, setFrequencyModulator) - 12usize];
3325 ["Offset of field: playdate_sound_effect_ringmodulator::getFrequencyModulator"]
3326 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, getFrequencyModulator) - 16usize];
3327};
3328#[repr(C)]
3329#[derive(Debug, Copy, Clone)]
3330#[must_use]
3331pub struct DelayLine {
3332 _unused: [u8; 0],
3333}
3334#[repr(C)]
3335#[derive(Debug, Copy, Clone)]
3336#[must_use]
3337pub struct DelayLineTap {
3338 _unused: [u8; 0],
3339}
3340#[repr(C)]
3341#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3342#[must_use]
3343pub struct playdate_sound_effect_delayline {
3344 #[doc = "`DelayLine* playdate->sound->effect->delayline->newDelayLine(int length, int stereo)`\n\nCreates a new delay line effect. The *length* parameter is given in samples."]
3345 pub newDelayLine: ::core::option::Option<unsafe extern "C" fn(length: core::ffi::c_int,
3346 stereo: core::ffi::c_int)
3347 -> *mut DelayLine>,
3348 #[doc = "`void playdate->sound->effect->delayline->freeDelayLine(DelayLine* delay)`\n\nFrees the delay line."]
3349 pub freeDelayLine: ::core::option::Option<unsafe extern "C" fn(filter: *mut DelayLine)>,
3350 #[doc = "`void playdate->sound->effect->delayline->setLength(DelayLine* d, int frames)`\n\nChanges the length of the delay line, clearing its contents. This function reallocates the audio buffer, so it is not safe to call while the delay line is in use."]
3351 pub setLength: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine, frames: core::ffi::c_int)>,
3352 #[doc = "`void playdate->sound->effect->delayline->setFeedback(DelayLine* d, float fb)`\n\nSets the feedback level of the delay line."]
3353 pub setFeedback: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine, fb: core::ffi::c_float)>,
3354 #[doc = "`DelayLineTap* playdate->sound->effect->delayline->addTap(DelayLine* d, int delay)`\n\nReturns a new tap on the delay line, at the given position. *delay* must be less than or equal to the length of the delay line."]
3355 pub addTap: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine,
3356 delay: core::ffi::c_int)
3357 -> *mut DelayLineTap>,
3358 #[doc = "`void playdate->sound->effect->delayline->freeTap(DelayLineTap* tap)`\n\nFrees a tap previously created with [playdate→sound→delayline→addTap()](#f-sound.effect.delayline.addTap), first removing it from the sound engine if needed."]
3359 pub freeTap: ::core::option::Option<unsafe extern "C" fn(tap: *mut DelayLineTap)>,
3360 #[doc = "`void playdate->sound->effect->delayline->setTapDelay(DelayLineTap* tap, int frames)`\n\nSets the position of the tap on the delay line, up to the delay line’s length."]
3361 pub setTapDelay: ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, frames: core::ffi::c_int)>,
3362 #[doc = "`void playdate->sound->effect->delayline->setTapDelayModulator(DelayLineTap* tap, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the tap delay. If the signal is continuous (e.g. an envelope or a triangle LFO, but not a square LFO) playback is sped up or slowed down to compress or expand time. Set to *NULL* to clear the modulator."]
3363 pub setTapDelayModulator:
3364 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, mod_: *mut PDSynthSignalValue)>,
3365 #[doc = "`PDSynthSignalValue* playdate->sound->effect->delayline->getTapDelayModulator(DelayLineTap* tap)`\n\nReturns the current delay modulator."]
3366 pub getTapDelayModulator:
3367 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap) -> *mut PDSynthSignalValue>,
3368 #[doc = "`void playdate->sound->effect->delayline->setTapChannelsFlipped(DelayLineTap* tap, int flip)`\n\nIf the delay line is stereo and *flip* is set, the tap outputs the delay line’s left channel to its right output and vice versa."]
3369 pub setTapChannelsFlipped:
3370 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, flip: core::ffi::c_int)>,
3371}
3372#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3373const _: () = {
3374 ["Size of playdate_sound_effect_delayline"]
3375 [::core::mem::size_of::<playdate_sound_effect_delayline>() - 40usize];
3376 ["Alignment of playdate_sound_effect_delayline"]
3377 [::core::mem::align_of::<playdate_sound_effect_delayline>() - 4usize];
3378 ["Offset of field: playdate_sound_effect_delayline::newDelayLine"]
3379 [::core::mem::offset_of!(playdate_sound_effect_delayline, newDelayLine) - 0usize];
3380 ["Offset of field: playdate_sound_effect_delayline::freeDelayLine"]
3381 [::core::mem::offset_of!(playdate_sound_effect_delayline, freeDelayLine) - 4usize];
3382 ["Offset of field: playdate_sound_effect_delayline::setLength"]
3383 [::core::mem::offset_of!(playdate_sound_effect_delayline, setLength) - 8usize];
3384 ["Offset of field: playdate_sound_effect_delayline::setFeedback"]
3385 [::core::mem::offset_of!(playdate_sound_effect_delayline, setFeedback) - 12usize];
3386 ["Offset of field: playdate_sound_effect_delayline::addTap"]
3387 [::core::mem::offset_of!(playdate_sound_effect_delayline, addTap) - 16usize];
3388 ["Offset of field: playdate_sound_effect_delayline::freeTap"]
3389 [::core::mem::offset_of!(playdate_sound_effect_delayline, freeTap) - 20usize];
3390 ["Offset of field: playdate_sound_effect_delayline::setTapDelay"]
3391 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapDelay) - 24usize];
3392 ["Offset of field: playdate_sound_effect_delayline::setTapDelayModulator"]
3393 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapDelayModulator) - 28usize];
3394 ["Offset of field: playdate_sound_effect_delayline::getTapDelayModulator"]
3395 [::core::mem::offset_of!(playdate_sound_effect_delayline, getTapDelayModulator) - 32usize];
3396 ["Offset of field: playdate_sound_effect_delayline::setTapChannelsFlipped"]
3397 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapChannelsFlipped) - 36usize];
3398};
3399#[repr(C)]
3400#[derive(Debug, Copy, Clone)]
3401#[must_use]
3402pub struct Overdrive {
3403 _unused: [u8; 0],
3404}
3405#[repr(C)]
3406#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3407#[must_use]
3408pub struct playdate_sound_effect_overdrive {
3409 #[doc = "`Overdrive* playdate->sound->effect->overdrive->newOverdrive(void)`\n\nReturns a new overdrive effect."]
3410 pub newOverdrive: ::core::option::Option<unsafe extern "C" fn() -> *mut Overdrive>,
3411 #[doc = "`void playdate->sound->effect->overdrive->freeOverdrive(Overdrive* filter)`\n\nFrees the given effect."]
3412 pub freeOverdrive: ::core::option::Option<unsafe extern "C" fn(filter: *mut Overdrive)>,
3413 #[doc = "`void playdate->sound->effect->overdrive->setGain(Overdrive* filter, float gain)`\n\nSets the gain of the overdrive effect."]
3414 pub setGain: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, gain: core::ffi::c_float)>,
3415 #[doc = "`void playdate->sound->effect->overdrive->setLimit(Overdrive* filter, float limit)`\n\nSets the level where the amplified input clips."]
3416 pub setLimit: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, limit: core::ffi::c_float)>,
3417 #[doc = "`void playdate->sound->effect->overdrive->setLimitModulator(Overdrive* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the limit parameter. Set to *NULL* to clear the modulator."]
3418 pub setLimitModulator:
3419 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, mod_: *mut PDSynthSignalValue)>,
3420 #[doc = "`PDSynthSignalValue* playdate->sound->effect->overdrive->getLimitModulator(RingMoOverdrivedulator* filter)`\n\nReturns the currently set limit modulator."]
3421 pub getLimitModulator:
3422 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive) -> *mut PDSynthSignalValue>,
3423 #[doc = "`void playdate->sound->effect->overdrive->setOffset(Overdrive* filter, float offset)`\n\nAdds an offset to the upper and lower limits to create an asymmetric clipping."]
3424 pub setOffset: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, offset: core::ffi::c_float)>,
3425 #[doc = "`void playdate->sound->effect->overdrive->setOffsetModulator(Overdrive* filter, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the offset parameter. Set to *NULL* to clear the modulator."]
3426 pub setOffsetModulator:
3427 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, mod_: *mut PDSynthSignalValue)>,
3428 #[doc = "`PDSynthSignalValue* playdate->sound->effect->overdrive->getOffsetModulator(RingMoOverdrivedulator* filter)`\n\nReturns the currently set offset modulator."]
3429 pub getOffsetModulator:
3430 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive) -> *mut PDSynthSignalValue>,
3431}
3432#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3433const _: () = {
3434 ["Size of playdate_sound_effect_overdrive"]
3435 [::core::mem::size_of::<playdate_sound_effect_overdrive>() - 36usize];
3436 ["Alignment of playdate_sound_effect_overdrive"]
3437 [::core::mem::align_of::<playdate_sound_effect_overdrive>() - 4usize];
3438 ["Offset of field: playdate_sound_effect_overdrive::newOverdrive"]
3439 [::core::mem::offset_of!(playdate_sound_effect_overdrive, newOverdrive) - 0usize];
3440 ["Offset of field: playdate_sound_effect_overdrive::freeOverdrive"]
3441 [::core::mem::offset_of!(playdate_sound_effect_overdrive, freeOverdrive) - 4usize];
3442 ["Offset of field: playdate_sound_effect_overdrive::setGain"]
3443 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setGain) - 8usize];
3444 ["Offset of field: playdate_sound_effect_overdrive::setLimit"]
3445 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setLimit) - 12usize];
3446 ["Offset of field: playdate_sound_effect_overdrive::setLimitModulator"]
3447 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setLimitModulator) - 16usize];
3448 ["Offset of field: playdate_sound_effect_overdrive::getLimitModulator"]
3449 [::core::mem::offset_of!(playdate_sound_effect_overdrive, getLimitModulator) - 20usize];
3450 ["Offset of field: playdate_sound_effect_overdrive::setOffset"]
3451 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setOffset) - 24usize];
3452 ["Offset of field: playdate_sound_effect_overdrive::setOffsetModulator"]
3453 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setOffsetModulator) - 28usize];
3454 ["Offset of field: playdate_sound_effect_overdrive::getOffsetModulator"]
3455 [::core::mem::offset_of!(playdate_sound_effect_overdrive, getOffsetModulator) - 32usize];
3456};
3457#[repr(C)]
3458#[derive(Debug, Copy, Clone)]
3459#[must_use]
3460pub struct SoundEffect {
3461 _unused: [u8; 0],
3462}
3463pub type effectProc = ::core::option::Option<unsafe extern "C" fn(e: *mut SoundEffect,
3464 left: *mut i32,
3465 right: *mut i32,
3466 nsamples: core::ffi::c_int,
3467 bufactive: core::ffi::c_int)
3468 -> core::ffi::c_int>;
3469#[repr(C)]
3470#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3471#[must_use]
3472pub struct playdate_sound_effect {
3473 #[doc = "`SoundEffect* playdate->sound->effect->newEffect(effectProc* proc, void* userdata)`\n\neffectProc\n\n```cpp\ntypedef int effectProc(SoundEffect* e, int32_t* left, int32_t* right, int nsamples, int bufactive);\n```\n\nCreates a new effect using the given processing function. *bufactive* is 1 if samples have been set in the left or right buffers. The function should return 1 if it changed the buffer samples, otherwise 0. *left* and *right* (if the effect is on a stereo channel) are sample buffers in Q8.24 format."]
3474 pub newEffect: ::core::option::Option<unsafe extern "C" fn(proc_: effectProc,
3475 userdata: *mut core::ffi::c_void)
3476 -> *mut SoundEffect>,
3477 #[doc = "`void playdate->sound->effect->freeEffect(SoundEffect* effect)`\n\nFrees the given effect."]
3478 pub freeEffect: ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect)>,
3479 #[doc = "`void playdate->sound->effect->setMix(SoundEffect* effect, float level)`\n\nSets the wet/dry mix for the effect. A level of 1 (full wet) replaces the input with the effect output; 0 leaves the effect out of the mix (which is useful if you’re using a delay line with taps and don’t want to hear the delay line itself)."]
3480 pub setMix: ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, level: core::ffi::c_float)>,
3481 #[doc = "`void playdate->sound->effect->setMixModulator(SoundEffect* effect, PDSynthSignalValue* signal)`\n\nSets a [signal](#C-sound.signal) to modulate the effect’s mix level. Set to *NULL* to clear the modulator."]
3482 pub setMixModulator:
3483 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, signal: *mut PDSynthSignalValue)>,
3484 #[doc = "`PDSynthSignalValue* playdate->sound->effect->getMixModulator(SoundEffect* effect)`\n\nReturns the current mix modulator for the effect."]
3485 pub getMixModulator:
3486 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect) -> *mut PDSynthSignalValue>,
3487 #[doc = "`void playdate->sound->effect->setUserdata(SoundEffect* effect, void* userdata)`"]
3488 pub setUserdata:
3489 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, userdata: *mut core::ffi::c_void)>,
3490 #[doc = "`void* playdate->sound->effect->getUserdata(SoundEffect* effect)`\n\nSets or gets a userdata value for the effect."]
3491 pub getUserdata:
3492 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect) -> *mut core::ffi::c_void>,
3493 pub twopolefilter: *const playdate_sound_effect_twopolefilter,
3494 pub onepolefilter: *const playdate_sound_effect_onepolefilter,
3495 pub bitcrusher: *const playdate_sound_effect_bitcrusher,
3496 pub ringmodulator: *const playdate_sound_effect_ringmodulator,
3497 pub delayline: *const playdate_sound_effect_delayline,
3498 pub overdrive: *const playdate_sound_effect_overdrive,
3499}
3500#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3501const _: () = {
3502 ["Size of playdate_sound_effect"][::core::mem::size_of::<playdate_sound_effect>() - 52usize];
3503 ["Alignment of playdate_sound_effect"][::core::mem::align_of::<playdate_sound_effect>() - 4usize];
3504 ["Offset of field: playdate_sound_effect::newEffect"]
3505 [::core::mem::offset_of!(playdate_sound_effect, newEffect) - 0usize];
3506 ["Offset of field: playdate_sound_effect::freeEffect"]
3507 [::core::mem::offset_of!(playdate_sound_effect, freeEffect) - 4usize];
3508 ["Offset of field: playdate_sound_effect::setMix"]
3509 [::core::mem::offset_of!(playdate_sound_effect, setMix) - 8usize];
3510 ["Offset of field: playdate_sound_effect::setMixModulator"]
3511 [::core::mem::offset_of!(playdate_sound_effect, setMixModulator) - 12usize];
3512 ["Offset of field: playdate_sound_effect::getMixModulator"]
3513 [::core::mem::offset_of!(playdate_sound_effect, getMixModulator) - 16usize];
3514 ["Offset of field: playdate_sound_effect::setUserdata"]
3515 [::core::mem::offset_of!(playdate_sound_effect, setUserdata) - 20usize];
3516 ["Offset of field: playdate_sound_effect::getUserdata"]
3517 [::core::mem::offset_of!(playdate_sound_effect, getUserdata) - 24usize];
3518 ["Offset of field: playdate_sound_effect::twopolefilter"]
3519 [::core::mem::offset_of!(playdate_sound_effect, twopolefilter) - 28usize];
3520 ["Offset of field: playdate_sound_effect::onepolefilter"]
3521 [::core::mem::offset_of!(playdate_sound_effect, onepolefilter) - 32usize];
3522 ["Offset of field: playdate_sound_effect::bitcrusher"]
3523 [::core::mem::offset_of!(playdate_sound_effect, bitcrusher) - 36usize];
3524 ["Offset of field: playdate_sound_effect::ringmodulator"]
3525 [::core::mem::offset_of!(playdate_sound_effect, ringmodulator) - 40usize];
3526 ["Offset of field: playdate_sound_effect::delayline"]
3527 [::core::mem::offset_of!(playdate_sound_effect, delayline) - 44usize];
3528 ["Offset of field: playdate_sound_effect::overdrive"]
3529 [::core::mem::offset_of!(playdate_sound_effect, overdrive) - 48usize];
3530};
3531impl Default for playdate_sound_effect {
3532 fn default() -> Self {
3533 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3534 unsafe {
3535 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3536 s.assume_init()
3537 }
3538 }
3539}
3540#[repr(C)]
3541#[derive(Debug, Copy, Clone)]
3542#[must_use]
3543pub struct SoundChannel {
3544 _unused: [u8; 0],
3545}
3546pub type AudioSourceFunction = ::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void,
3547 left: *mut i16,
3548 right: *mut i16,
3549 len: core::ffi::c_int)
3550 -> core::ffi::c_int>;
3551#[repr(C)]
3552#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3553#[must_use]
3554pub struct playdate_sound_channel {
3555 #[doc = "`SoundChannel* playdate->sound->channel->newChannel(void)`\n\nReturns a new *SoundChannel* object."]
3556 pub newChannel: ::core::option::Option<unsafe extern "C" fn() -> *mut SoundChannel>,
3557 #[doc = "`void playdate->sound->channel->freeChannel(SoundChannel* channel)`\n\nFrees the given *SoundChannel*."]
3558 pub freeChannel: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel)>,
3559 #[doc = "`void playdate->sound->channel->addSource(SoundChannel* channel, SoundSource* source)`\n\nAdds a [SoundSource](#f-sound.source) to the channel. If a source is not assigned to a channel, it plays on the default global channel."]
3560 pub addSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3561 source: *mut SoundSource)
3562 -> core::ffi::c_int>,
3563 #[doc = "`int playdate->sound->channel->removeSource(SoundChannel* channel, SoundSource* source)`\n\nRemoves a [SoundSource](#f-sound.source) to the channel. Returns 1 if the source was found in (and removed from) the channel, otherwise 0."]
3564 pub removeSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3565 source: *mut SoundSource)
3566 -> core::ffi::c_int>,
3567 #[doc = "`SoundSource* playdate->sound->channel->addCallbackSource(SoundChannel* channel, AudioSourceFunction* callback, void* context, int stereo)`\n\nCreates a new [SoundSource](#f-sound.source) using the given data provider callback and adds it to the channel.\n\nAudioSourceFunction\n\n```cpp\nint AudioSourceFunction(void* context, int16_t* left, int16_t* right, int len)\n```\n\nThis function should fill the passed-in *left* buffer (and *right* if it’s a stereo source) with *len* samples each and return 1, or return 0 if the source is silent through the cycle. The caller takes ownership of the allocated SoundSource, and should free it with\n\n```cpp\nplaydate->system->realloc(source, 0);\n```\n\nwhen it is not longer in use."]
3568 pub addCallbackSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3569 callback: AudioSourceFunction,
3570 context: *mut core::ffi::c_void,
3571 stereo: core::ffi::c_int)
3572 -> *mut SoundSource>,
3573 #[doc = "`void playdate->sound->channel->addEffect(SoundChannel* channel, SoundEffect* effect)`\n\nAdds a [SoundEffect](#f-sound.effect) to the channel."]
3574 pub addEffect:
3575 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, effect: *mut SoundEffect)>,
3576 #[doc = "`void playdate->sound->channel->removeEffect(SoundChannel* channel, SoundEffect* effect)`\n\nRemoves a [SoundEffect](#f-sound.effect) from the channel."]
3577 pub removeEffect:
3578 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, effect: *mut SoundEffect)>,
3579 #[doc = "`void playdate->sound->channel->setVolume(SoundChannel* channel, float volume)`\n\nSets the volume for the channel, in the range [0-1]."]
3580 pub setVolume:
3581 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, volume: core::ffi::c_float)>,
3582 #[doc = "`float playdate->sound->channel->getVolume(SoundChannel* channel)`\n\nGets the volume for the channel, in the range [0-1]."]
3583 pub getVolume: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> core::ffi::c_float>,
3584 #[doc = "`void playdate->sound->channel->setVolumeModulator(SoundChannel* channel, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the channel volume. Set to *NULL* to clear the modulator."]
3585 pub setVolumeModulator:
3586 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, mod_: *mut PDSynthSignalValue)>,
3587 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getVolumeModulator(SoundChannel* channel)`\n\nGets a [signal](#C-sound.signal) modulating the channel volume."]
3588 pub getVolumeModulator:
3589 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3590 #[doc = "`void playdate->sound->channel->setPan(SoundChannel* channel, float pan)`\n\nSets the pan parameter for the channel. Valid values are in the range [-1,1], where -1 is left, 0 is center, and 1 is right."]
3591 pub setPan: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, pan: core::ffi::c_float)>,
3592 #[doc = "`void playdate->sound->channel->setPanModulator(SoundChannel* channel, PDSynthSignalValue* mod)`\n\nSets a [signal](#C-sound.signal) to modulate the channel pan. Set to *NULL* to clear the modulator."]
3593 pub setPanModulator:
3594 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, mod_: *mut PDSynthSignalValue)>,
3595 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getPanModulator(SoundChannel* channel)`\n\nGets a [signal](#C-sound.signal) modulating the channel pan."]
3596 pub getPanModulator:
3597 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3598 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getDryLevelSignal(SoundChannel* channel)`\n\nReturns a signal that follows the volume of the channel before effects are applied."]
3599 pub getDryLevelSignal:
3600 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3601 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getWetLevelSignal(SoundChannel* channel)`\n\nReturns a signal that follows the volume of the channel after effects are applied."]
3602 pub getWetLevelSignal:
3603 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3604}
3605#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3606const _: () = {
3607 ["Size of playdate_sound_channel"][::core::mem::size_of::<playdate_sound_channel>() - 64usize];
3608 ["Alignment of playdate_sound_channel"][::core::mem::align_of::<playdate_sound_channel>() - 4usize];
3609 ["Offset of field: playdate_sound_channel::newChannel"]
3610 [::core::mem::offset_of!(playdate_sound_channel, newChannel) - 0usize];
3611 ["Offset of field: playdate_sound_channel::freeChannel"]
3612 [::core::mem::offset_of!(playdate_sound_channel, freeChannel) - 4usize];
3613 ["Offset of field: playdate_sound_channel::addSource"]
3614 [::core::mem::offset_of!(playdate_sound_channel, addSource) - 8usize];
3615 ["Offset of field: playdate_sound_channel::removeSource"]
3616 [::core::mem::offset_of!(playdate_sound_channel, removeSource) - 12usize];
3617 ["Offset of field: playdate_sound_channel::addCallbackSource"]
3618 [::core::mem::offset_of!(playdate_sound_channel, addCallbackSource) - 16usize];
3619 ["Offset of field: playdate_sound_channel::addEffect"]
3620 [::core::mem::offset_of!(playdate_sound_channel, addEffect) - 20usize];
3621 ["Offset of field: playdate_sound_channel::removeEffect"]
3622 [::core::mem::offset_of!(playdate_sound_channel, removeEffect) - 24usize];
3623 ["Offset of field: playdate_sound_channel::setVolume"]
3624 [::core::mem::offset_of!(playdate_sound_channel, setVolume) - 28usize];
3625 ["Offset of field: playdate_sound_channel::getVolume"]
3626 [::core::mem::offset_of!(playdate_sound_channel, getVolume) - 32usize];
3627 ["Offset of field: playdate_sound_channel::setVolumeModulator"]
3628 [::core::mem::offset_of!(playdate_sound_channel, setVolumeModulator) - 36usize];
3629 ["Offset of field: playdate_sound_channel::getVolumeModulator"]
3630 [::core::mem::offset_of!(playdate_sound_channel, getVolumeModulator) - 40usize];
3631 ["Offset of field: playdate_sound_channel::setPan"]
3632 [::core::mem::offset_of!(playdate_sound_channel, setPan) - 44usize];
3633 ["Offset of field: playdate_sound_channel::setPanModulator"]
3634 [::core::mem::offset_of!(playdate_sound_channel, setPanModulator) - 48usize];
3635 ["Offset of field: playdate_sound_channel::getPanModulator"]
3636 [::core::mem::offset_of!(playdate_sound_channel, getPanModulator) - 52usize];
3637 ["Offset of field: playdate_sound_channel::getDryLevelSignal"]
3638 [::core::mem::offset_of!(playdate_sound_channel, getDryLevelSignal) - 56usize];
3639 ["Offset of field: playdate_sound_channel::getWetLevelSignal"]
3640 [::core::mem::offset_of!(playdate_sound_channel, getWetLevelSignal) - 60usize];
3641};
3642pub type RecordCallback = ::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void,
3643 buffer: *mut i16,
3644 length: core::ffi::c_int)
3645 -> core::ffi::c_int>;
3646#[repr(u8)]
3647#[must_use]
3648#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3649pub enum MicSource {
3650 kMicInputAutodetect = 0,
3651 kMicInputInternal = 1,
3652 kMicInputHeadset = 2,
3653}
3654#[repr(C)]
3655#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3656#[must_use]
3657pub struct playdate_sound { pub channel : * const playdate_sound_channel , pub fileplayer : * const playdate_sound_fileplayer , pub sample : * const playdate_sound_sample , pub sampleplayer : * const playdate_sound_sampleplayer , pub synth : * const playdate_sound_synth , pub sequence : * const playdate_sound_sequence , pub effect : * const playdate_sound_effect , pub lfo : * const playdate_sound_lfo , pub envelope : * const playdate_sound_envelope , pub source : * const playdate_sound_source , pub controlsignal : * const playdate_control_signal , pub track : * const playdate_sound_track , pub instrument : * const playdate_sound_instrument , # [doc = "`uint32_t playdate->sound->getCurrentTime(void)`\n\nReturns the sound engine’s current time value, in units of sample frames, 44,100 per second.\n\nEquivalent to [`playdate.sound.getCurrentTime()`](./Inside%20Playdate.html#f-sound.getCurrentTime) in the Lua API."] pub getCurrentTime : :: core :: option :: Option < unsafe extern "C" fn () -> u32 > , # [doc = "`SoundSource* playdate->sound->addSource(AudioSourceFunction* callback, void* context, int stereo)`\n\nThe *callback* function you pass in will be called every audio render cycle.\n\nAudioSourceFunction\n\n```cpp\nint AudioSourceFunction(void* context, int16_t* left, int16_t* right, int len)\n```\n\nThis function should fill the passed-in *left* buffer (and *right* if it’s a stereo source) with *len* samples each and return 1, or return 0 if the source is silent through the cycle."] pub addSource : :: core :: option :: Option < unsafe extern "C" fn (callback : AudioSourceFunction , context : * mut core :: ffi :: c_void , stereo : core :: ffi :: c_int) -> * mut SoundSource > , # [doc = "`SoundChannel* playdate->sound->getDefaultChannel(void)`\n\nReturns the default channel, where sound sources play if they haven’t been explicity assigned to a different channel."] pub getDefaultChannel : :: core :: option :: Option < unsafe extern "C" fn () -> * mut SoundChannel > , # [doc = "`int playdate->sound->addChannel(SoundChannel* channel)`\n\nAdds the given channel to the sound engine. Returns 1 if the channel was added, 0 if it was already in the engine."] pub addChannel : :: core :: option :: Option < unsafe extern "C" fn (channel : * mut SoundChannel) -> core :: ffi :: c_int > , # [doc = "`int playdate->sound->removeChannel(SoundChannel* channel)`\n\nRemoves the given channel from the sound engine. Returns 1 if the channel was successfully removed, 0 if the channel is the default channel or hadn’t been previously added."] pub removeChannel : :: core :: option :: Option < unsafe extern "C" fn (channel : * mut SoundChannel) -> core :: ffi :: c_int > , # [doc = "`int playdate->sound->setMicCallback(AudioInputFunction* callback, void* context, enum MicSource source)`\n\nThe *callback* you pass in will be called every audio cycle.\n\nAudioInputFunction\n\n```cpp\nint AudioInputFunction(void* context, int16_t* data, int len)\n```\n\nenum MicSource\n\n```cpp\nenum MicSource {\n\tkMicInputAutodetect = 0,\n\tkMicInputInternal = 1,\n\tkMicInputHeadset = 2\n};\n```\n\nYour input callback will be called with the recorded audio data, a monophonic stream of samples. The function should return 1 to continue recording, 0 to stop recording.\n\nThe Playdate hardware has a circuit that attempts to autodetect the presence of a headset mic, but there are cases where you may want to override this. For instance, if you’re using a headphone splitter to wire an external source to the mic input, the detector may not always see the input. Setting the source to `kMicInputHeadset` forces recording from the headset. Using `kMicInputInternal` records from the device mic even when a headset with a mic is plugged in. And `kMicInputAutodetect` uses a headset mic if one is detected, otherwise the device microphone. `setMicCallback()` returns which source the function used, internal or headset, or 0 on error."] pub setMicCallback : :: core :: option :: Option < unsafe extern "C" fn (callback : RecordCallback , context : * mut core :: ffi :: c_void , source : MicSource) -> core :: ffi :: c_int > , # [doc = "`void playdate->sound->getHeadphoneState(int* headphone, int* mic, void (*changeCallback)(int headphone, int mic))`\n\nIf *headphone* contains a pointer to an int, the value is set to 1 if headphones are currently plugged in. Likewise, *mic* is set if the headphones include a microphone. If *changeCallback* is provided, it will be called when the headset or mic status changes, and audio output will **not** automatically switch from speaker to headphones when headphones are plugged in (and vice versa). In this case, the callback should use `playdate→sound→setOutputsActive()` to change the output if needed.\n\nEquivalent to [`playdate.sound.getHeadphoneState()`](./Inside%20Playdate.html#f-sound.getHeadphoneState) in the Lua API."] pub getHeadphoneState : :: core :: option :: Option < unsafe extern "C" fn (headphone : * mut core :: ffi :: c_int , headsetmic : * mut core :: ffi :: c_int , changeCallback : :: core :: option :: Option < unsafe extern "C" fn (headphone : core :: ffi :: c_int , mic : core :: ffi :: c_int) >) > , # [doc = "`void playdate->sound->setOutputsActive(int headphone, int speaker)`\n\nForce audio output to the given outputs, regardless of headphone status.\n\nEquivalent to [`playdate.sound.setOutputsActive()`](./Inside%20Playdate.html#f-sound.setOutputsActive) in the Lua API."] pub setOutputsActive : :: core :: option :: Option < unsafe extern "C" fn (headphone : core :: ffi :: c_int , speaker : core :: ffi :: c_int) > , # [doc = "`int playdate->sound->removeSource(SoundSource* source)`\n\nRemoves the given [SoundSource](#C-sound.source) object from its channel, whether it’s in the default channel or a channel created with [playdate→sound→addChannel()](#f-sound.addChannel). Returns 1 if a source was removed, 0 if the source wasn’t in a channel."] pub removeSource : :: core :: option :: Option < unsafe extern "C" fn (source : * mut SoundSource) -> core :: ffi :: c_int > , pub signal : * const playdate_sound_signal , pub getError : :: core :: option :: Option < unsafe extern "C" fn () -> * const core :: ffi :: c_char > , }
3658#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3659const _: () = {
3660 ["Size of playdate_sound"][::core::mem::size_of::<playdate_sound>() - 96usize];
3661 ["Alignment of playdate_sound"][::core::mem::align_of::<playdate_sound>() - 4usize];
3662 ["Offset of field: playdate_sound::channel"][::core::mem::offset_of!(playdate_sound, channel) - 0usize];
3663 ["Offset of field: playdate_sound::fileplayer"][::core::mem::offset_of!(playdate_sound, fileplayer) - 4usize];
3664 ["Offset of field: playdate_sound::sample"][::core::mem::offset_of!(playdate_sound, sample) - 8usize];
3665 ["Offset of field: playdate_sound::sampleplayer"]
3666 [::core::mem::offset_of!(playdate_sound, sampleplayer) - 12usize];
3667 ["Offset of field: playdate_sound::synth"][::core::mem::offset_of!(playdate_sound, synth) - 16usize];
3668 ["Offset of field: playdate_sound::sequence"][::core::mem::offset_of!(playdate_sound, sequence) - 20usize];
3669 ["Offset of field: playdate_sound::effect"][::core::mem::offset_of!(playdate_sound, effect) - 24usize];
3670 ["Offset of field: playdate_sound::lfo"][::core::mem::offset_of!(playdate_sound, lfo) - 28usize];
3671 ["Offset of field: playdate_sound::envelope"][::core::mem::offset_of!(playdate_sound, envelope) - 32usize];
3672 ["Offset of field: playdate_sound::source"][::core::mem::offset_of!(playdate_sound, source) - 36usize];
3673 ["Offset of field: playdate_sound::controlsignal"]
3674 [::core::mem::offset_of!(playdate_sound, controlsignal) - 40usize];
3675 ["Offset of field: playdate_sound::track"][::core::mem::offset_of!(playdate_sound, track) - 44usize];
3676 ["Offset of field: playdate_sound::instrument"][::core::mem::offset_of!(playdate_sound, instrument) - 48usize];
3677 ["Offset of field: playdate_sound::getCurrentTime"]
3678 [::core::mem::offset_of!(playdate_sound, getCurrentTime) - 52usize];
3679 ["Offset of field: playdate_sound::addSource"][::core::mem::offset_of!(playdate_sound, addSource) - 56usize];
3680 ["Offset of field: playdate_sound::getDefaultChannel"]
3681 [::core::mem::offset_of!(playdate_sound, getDefaultChannel) - 60usize];
3682 ["Offset of field: playdate_sound::addChannel"][::core::mem::offset_of!(playdate_sound, addChannel) - 64usize];
3683 ["Offset of field: playdate_sound::removeChannel"]
3684 [::core::mem::offset_of!(playdate_sound, removeChannel) - 68usize];
3685 ["Offset of field: playdate_sound::setMicCallback"]
3686 [::core::mem::offset_of!(playdate_sound, setMicCallback) - 72usize];
3687 ["Offset of field: playdate_sound::getHeadphoneState"]
3688 [::core::mem::offset_of!(playdate_sound, getHeadphoneState) - 76usize];
3689 ["Offset of field: playdate_sound::setOutputsActive"]
3690 [::core::mem::offset_of!(playdate_sound, setOutputsActive) - 80usize];
3691 ["Offset of field: playdate_sound::removeSource"]
3692 [::core::mem::offset_of!(playdate_sound, removeSource) - 84usize];
3693 ["Offset of field: playdate_sound::signal"][::core::mem::offset_of!(playdate_sound, signal) - 88usize];
3694 ["Offset of field: playdate_sound::getError"][::core::mem::offset_of!(playdate_sound, getError) - 92usize];
3695};
3696impl Default for playdate_sound {
3697 fn default() -> Self {
3698 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3699 unsafe {
3700 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3701 s.assume_init()
3702 }
3703 }
3704}
3705#[repr(C)]
3706#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3707#[must_use]
3708pub struct playdate_display {
3709 #[doc = "`int playdate->display->getWidth(void)`\n\nReturns the width of the display, taking the current scale into account; e.g., if the scale is 2, this function returns 200 instead of 400.\n\nEquivalent to [`playdate.display.getWidth()`](./Inside%20Playdate.html#f-display.getWidth) in the Lua API."]
3710 pub getWidth: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
3711 #[doc = "`int playdate->display->getHeight(void)`\n\nReturns the height of the display, taking the current scale into account; e.g., if the scale is 2, this function returns 120 instead of 240.\n\nEquivalent to [`playdate.display.getHeight()`](./Inside%20Playdate.html#f-display.getHeight) in the Lua API."]
3712 pub getHeight: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
3713 #[doc = "`void playdate->display->setRefreshRate(float rate)`\n\nSets the nominal refresh rate in frames per second. The default is 30 fps, which is a recommended figure that balances animation smoothness with performance and power considerations. Maximum is 50 fps.\n\nIf *rate* is 0, the game’s update callback (either Lua’s `playdate.update()` or the function specified by [playdate→system→setUpdateCallback()](#f-system.setUpdateCallback)) is called as soon as possible. Since the display refreshes line-by-line, and unchanged lines aren’t sent to the display, the update cycle will be faster than 30 times a second but at an indeterminate rate.\n\nEquivalent to [`playdate.display.setRefreshRate()`](./Inside%20Playdate.html#f-display.setRefreshRate) in the Lua API."]
3714 pub setRefreshRate: ::core::option::Option<unsafe extern "C" fn(rate: core::ffi::c_float)>,
3715 #[doc = "`void playdate->display->setInverted(int flag)`\n\nIf *flag* evaluates to true, the frame buffer is drawn inverted—black instead of white, and vice versa.\n\nEquivalent to [`playdate.display.setInverted()`](./Inside%20Playdate.html#f-display.setInverted) in the Lua API."]
3716 pub setInverted: ::core::option::Option<unsafe extern "C" fn(flag: core::ffi::c_int)>,
3717 #[doc = "`void playdate->display->setScale(unsigned int s)`\n\nSets the display scale factor. Valid values for *scale* are 1, 2, 4, and 8.\n\nThe top-left corner of the frame buffer is scaled up to fill the display; e.g., if the scale is set to 4, the pixels in rectangle [0,100] x [0,60] are drawn on the screen as 4 x 4 squares.\n\nEquivalent to [`playdate.display.setScale()`](./Inside%20Playdate.html#f-display.setScale) in the Lua API."]
3718 pub setScale: ::core::option::Option<unsafe extern "C" fn(s: core::ffi::c_uint)>,
3719 #[doc = "`void playdate->display->setMosaic(unsigned int x, unsigned int y)`\n\nAdds a mosaic effect to the display. Valid *x* and *y* values are between 0 and 3, inclusive.\n\nEquivalent to [`playdate.display.setMosaic`](./Inside%20Playdate.html#f-display.setMosaic) in the Lua API."]
3720 pub setMosaic: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_uint, y: core::ffi::c_uint)>,
3721 #[doc = "`void playdate->display->setFlipped(int x, int y)`\n\nFlips the display on the x or y axis, or both.\n\nEquivalent to [`playdate.display.setFlipped()`](./Inside%20Playdate.html#f-display.setFlipped) in the Lua API."]
3722 pub setFlipped: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int, y: core::ffi::c_int)>,
3723 #[doc = "`void playdate->display->setOffset(int dx, int dy)`\n\nOffsets the display by the given amount. Areas outside of the displayed area are filled with the current [background color](#f-graphics.setBackgroundColor).\n\nEquivalent to [`playdate.display.setOffset()`](./Inside%20Playdate.html#f-display.setOffset) in the Lua API."]
3724 pub setOffset: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int, y: core::ffi::c_int)>,
3725}
3726#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3727const _: () = {
3728 ["Size of playdate_display"][::core::mem::size_of::<playdate_display>() - 32usize];
3729 ["Alignment of playdate_display"][::core::mem::align_of::<playdate_display>() - 4usize];
3730 ["Offset of field: playdate_display::getWidth"][::core::mem::offset_of!(playdate_display, getWidth) - 0usize];
3731 ["Offset of field: playdate_display::getHeight"]
3732 [::core::mem::offset_of!(playdate_display, getHeight) - 4usize];
3733 ["Offset of field: playdate_display::setRefreshRate"]
3734 [::core::mem::offset_of!(playdate_display, setRefreshRate) - 8usize];
3735 ["Offset of field: playdate_display::setInverted"]
3736 [::core::mem::offset_of!(playdate_display, setInverted) - 12usize];
3737 ["Offset of field: playdate_display::setScale"][::core::mem::offset_of!(playdate_display, setScale) - 16usize];
3738 ["Offset of field: playdate_display::setMosaic"]
3739 [::core::mem::offset_of!(playdate_display, setMosaic) - 20usize];
3740 ["Offset of field: playdate_display::setFlipped"]
3741 [::core::mem::offset_of!(playdate_display, setFlipped) - 24usize];
3742 ["Offset of field: playdate_display::setOffset"]
3743 [::core::mem::offset_of!(playdate_display, setOffset) - 28usize];
3744};
3745#[repr(C)]
3746#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3747#[must_use]
3748pub struct PDScore {
3749 pub rank: u32,
3750 pub value: u32,
3751 pub player: *mut core::ffi::c_char,
3752}
3753#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3754const _: () = {
3755 ["Size of PDScore"][::core::mem::size_of::<PDScore>() - 12usize];
3756 ["Alignment of PDScore"][::core::mem::align_of::<PDScore>() - 4usize];
3757 ["Offset of field: PDScore::rank"][::core::mem::offset_of!(PDScore, rank) - 0usize];
3758 ["Offset of field: PDScore::value"][::core::mem::offset_of!(PDScore, value) - 4usize];
3759 ["Offset of field: PDScore::player"][::core::mem::offset_of!(PDScore, player) - 8usize];
3760};
3761impl Default for PDScore {
3762 fn default() -> Self {
3763 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3764 unsafe {
3765 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3766 s.assume_init()
3767 }
3768 }
3769}
3770#[repr(C)]
3771#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3772#[must_use]
3773pub struct PDScoresList {
3774 pub boardID: *mut core::ffi::c_char,
3775 pub count: core::ffi::c_uint,
3776 pub lastUpdated: u32,
3777 pub playerIncluded: core::ffi::c_int,
3778 pub limit: core::ffi::c_uint,
3779 pub scores: *mut PDScore,
3780}
3781#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3782const _: () = {
3783 ["Size of PDScoresList"][::core::mem::size_of::<PDScoresList>() - 24usize];
3784 ["Alignment of PDScoresList"][::core::mem::align_of::<PDScoresList>() - 4usize];
3785 ["Offset of field: PDScoresList::boardID"][::core::mem::offset_of!(PDScoresList, boardID) - 0usize];
3786 ["Offset of field: PDScoresList::count"][::core::mem::offset_of!(PDScoresList, count) - 4usize];
3787 ["Offset of field: PDScoresList::lastUpdated"][::core::mem::offset_of!(PDScoresList, lastUpdated) - 8usize];
3788 ["Offset of field: PDScoresList::playerIncluded"]
3789 [::core::mem::offset_of!(PDScoresList, playerIncluded) - 12usize];
3790 ["Offset of field: PDScoresList::limit"][::core::mem::offset_of!(PDScoresList, limit) - 16usize];
3791 ["Offset of field: PDScoresList::scores"][::core::mem::offset_of!(PDScoresList, scores) - 20usize];
3792};
3793impl Default for PDScoresList {
3794 fn default() -> Self {
3795 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3796 unsafe {
3797 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3798 s.assume_init()
3799 }
3800 }
3801}
3802#[repr(C)]
3803#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3804#[must_use]
3805pub struct PDBoard {
3806 pub boardID: *mut core::ffi::c_char,
3807 pub name: *mut core::ffi::c_char,
3808}
3809#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3810const _: () = {
3811 ["Size of PDBoard"][::core::mem::size_of::<PDBoard>() - 8usize];
3812 ["Alignment of PDBoard"][::core::mem::align_of::<PDBoard>() - 4usize];
3813 ["Offset of field: PDBoard::boardID"][::core::mem::offset_of!(PDBoard, boardID) - 0usize];
3814 ["Offset of field: PDBoard::name"][::core::mem::offset_of!(PDBoard, name) - 4usize];
3815};
3816impl Default for PDBoard {
3817 fn default() -> Self {
3818 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3819 unsafe {
3820 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3821 s.assume_init()
3822 }
3823 }
3824}
3825#[repr(C)]
3826#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3827#[must_use]
3828pub struct PDBoardsList {
3829 pub count: core::ffi::c_uint,
3830 pub lastUpdated: u32,
3831 pub boards: *mut PDBoard,
3832}
3833#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3834const _: () = {
3835 ["Size of PDBoardsList"][::core::mem::size_of::<PDBoardsList>() - 12usize];
3836 ["Alignment of PDBoardsList"][::core::mem::align_of::<PDBoardsList>() - 4usize];
3837 ["Offset of field: PDBoardsList::count"][::core::mem::offset_of!(PDBoardsList, count) - 0usize];
3838 ["Offset of field: PDBoardsList::lastUpdated"][::core::mem::offset_of!(PDBoardsList, lastUpdated) - 4usize];
3839 ["Offset of field: PDBoardsList::boards"][::core::mem::offset_of!(PDBoardsList, boards) - 8usize];
3840};
3841impl Default for PDBoardsList {
3842 fn default() -> Self {
3843 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3844 unsafe {
3845 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3846 s.assume_init()
3847 }
3848 }
3849}
3850pub type AddScoreCallback =
3851 ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore, errorMessage: *const core::ffi::c_char)>;
3852pub type PersonalBestCallback =
3853 ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore, errorMessage: *const core::ffi::c_char)>;
3854pub type BoardsListCallback =
3855 ::core::option::Option<unsafe extern "C" fn(boards: *mut PDBoardsList,
3856 errorMessage: *const core::ffi::c_char)>;
3857pub type ScoresCallback = ::core::option::Option<unsafe extern "C" fn(scores: *mut PDScoresList,
3858 errorMessage: *const core::ffi::c_char)>;
3859#[repr(C)]
3860#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3861#[must_use]
3862pub struct playdate_scoreboards {
3863 pub addScore: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3864 value: u32,
3865 callback: AddScoreCallback)
3866 -> core::ffi::c_int>,
3867 pub getPersonalBest: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3868 callback: PersonalBestCallback)
3869 -> core::ffi::c_int>,
3870 pub freeScore: ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore)>,
3871 pub getScoreboards:
3872 ::core::option::Option<unsafe extern "C" fn(callback: BoardsListCallback) -> core::ffi::c_int>,
3873 pub freeBoardsList: ::core::option::Option<unsafe extern "C" fn(boardsList: *mut PDBoardsList)>,
3874 pub getScores: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3875 callback: ScoresCallback)
3876 -> core::ffi::c_int>,
3877 pub freeScoresList: ::core::option::Option<unsafe extern "C" fn(scoresList: *mut PDScoresList)>,
3878}
3879#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3880const _: () = {
3881 ["Size of playdate_scoreboards"][::core::mem::size_of::<playdate_scoreboards>() - 28usize];
3882 ["Alignment of playdate_scoreboards"][::core::mem::align_of::<playdate_scoreboards>() - 4usize];
3883 ["Offset of field: playdate_scoreboards::addScore"]
3884 [::core::mem::offset_of!(playdate_scoreboards, addScore) - 0usize];
3885 ["Offset of field: playdate_scoreboards::getPersonalBest"]
3886 [::core::mem::offset_of!(playdate_scoreboards, getPersonalBest) - 4usize];
3887 ["Offset of field: playdate_scoreboards::freeScore"]
3888 [::core::mem::offset_of!(playdate_scoreboards, freeScore) - 8usize];
3889 ["Offset of field: playdate_scoreboards::getScoreboards"]
3890 [::core::mem::offset_of!(playdate_scoreboards, getScoreboards) - 12usize];
3891 ["Offset of field: playdate_scoreboards::freeBoardsList"]
3892 [::core::mem::offset_of!(playdate_scoreboards, freeBoardsList) - 16usize];
3893 ["Offset of field: playdate_scoreboards::getScores"]
3894 [::core::mem::offset_of!(playdate_scoreboards, getScores) - 20usize];
3895 ["Offset of field: playdate_scoreboards::freeScoresList"]
3896 [::core::mem::offset_of!(playdate_scoreboards, freeScoresList) - 24usize];
3897};
3898#[repr(C)]
3899#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3900#[must_use]
3901pub struct PlaydateAPI {
3902 pub system: *const playdate_sys,
3903 pub file: *const playdate_file,
3904 pub graphics: *const playdate_graphics,
3905 pub sprite: *const playdate_sprite,
3906 pub display: *const playdate_display,
3907 pub sound: *const playdate_sound,
3908 pub lua: *const playdate_lua,
3909 pub json: *const playdate_json,
3910 pub scoreboards: *const playdate_scoreboards,
3911}
3912#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3913const _: () = {
3914 ["Size of PlaydateAPI"][::core::mem::size_of::<PlaydateAPI>() - 36usize];
3915 ["Alignment of PlaydateAPI"][::core::mem::align_of::<PlaydateAPI>() - 4usize];
3916 ["Offset of field: PlaydateAPI::system"][::core::mem::offset_of!(PlaydateAPI, system) - 0usize];
3917 ["Offset of field: PlaydateAPI::file"][::core::mem::offset_of!(PlaydateAPI, file) - 4usize];
3918 ["Offset of field: PlaydateAPI::graphics"][::core::mem::offset_of!(PlaydateAPI, graphics) - 8usize];
3919 ["Offset of field: PlaydateAPI::sprite"][::core::mem::offset_of!(PlaydateAPI, sprite) - 12usize];
3920 ["Offset of field: PlaydateAPI::display"][::core::mem::offset_of!(PlaydateAPI, display) - 16usize];
3921 ["Offset of field: PlaydateAPI::sound"][::core::mem::offset_of!(PlaydateAPI, sound) - 20usize];
3922 ["Offset of field: PlaydateAPI::lua"][::core::mem::offset_of!(PlaydateAPI, lua) - 24usize];
3923 ["Offset of field: PlaydateAPI::json"][::core::mem::offset_of!(PlaydateAPI, json) - 28usize];
3924 ["Offset of field: PlaydateAPI::scoreboards"][::core::mem::offset_of!(PlaydateAPI, scoreboards) - 32usize];
3925};
3926impl Default for PlaydateAPI {
3927 fn default() -> Self {
3928 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3929 unsafe {
3930 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3931 s.assume_init()
3932 }
3933 }
3934}
3935#[repr(u8)]
3936#[must_use]
3937#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3938pub enum PDSystemEvent {
3939 kEventInit = 0,
3940 kEventInitLua = 1,
3941 kEventLock = 2,
3942 kEventUnlock = 3,
3943 kEventPause = 4,
3944 kEventResume = 5,
3945 kEventTerminate = 6,
3946 kEventKeyPressed = 7,
3947 kEventKeyReleased = 8,
3948 kEventLowPower = 9,
3949}