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(u32)]
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(u32)]
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(u32)]
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(u32)]
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(u32)]
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(u32)]
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(u32)]
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(u32)]
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>() - 64usize];
302 ["Alignment of playdate_video"][::core::mem::align_of::<playdate_video>() - 8usize];
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) - 8usize];
305 ["Offset of field: playdate_video::setContext"][::core::mem::offset_of!(playdate_video, setContext) - 16usize];
306 ["Offset of field: playdate_video::useScreenContext"]
307 [::core::mem::offset_of!(playdate_video, useScreenContext) - 24usize];
308 ["Offset of field: playdate_video::renderFrame"]
309 [::core::mem::offset_of!(playdate_video, renderFrame) - 32usize];
310 ["Offset of field: playdate_video::getError"][::core::mem::offset_of!(playdate_video, getError) - 40usize];
311 ["Offset of field: playdate_video::getInfo"][::core::mem::offset_of!(playdate_video, getInfo) - 48usize];
312 ["Offset of field: playdate_video::getContext"][::core::mem::offset_of!(playdate_video, getContext) - 56usize];
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>() - 512usize];
586 ["Alignment of playdate_graphics"][::core::mem::align_of::<playdate_graphics>() - 8usize];
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) - 8usize];
589 ["Offset of field: playdate_graphics::setBackgroundColor"]
590 [::core::mem::offset_of!(playdate_graphics, setBackgroundColor) - 16usize];
591 ["Offset of field: playdate_graphics::setStencil"]
592 [::core::mem::offset_of!(playdate_graphics, setStencil) - 24usize];
593 ["Offset of field: playdate_graphics::setDrawMode"]
594 [::core::mem::offset_of!(playdate_graphics, setDrawMode) - 32usize];
595 ["Offset of field: playdate_graphics::setDrawOffset"]
596 [::core::mem::offset_of!(playdate_graphics, setDrawOffset) - 40usize];
597 ["Offset of field: playdate_graphics::setClipRect"]
598 [::core::mem::offset_of!(playdate_graphics, setClipRect) - 48usize];
599 ["Offset of field: playdate_graphics::clearClipRect"]
600 [::core::mem::offset_of!(playdate_graphics, clearClipRect) - 56usize];
601 ["Offset of field: playdate_graphics::setLineCapStyle"]
602 [::core::mem::offset_of!(playdate_graphics, setLineCapStyle) - 64usize];
603 ["Offset of field: playdate_graphics::setFont"][::core::mem::offset_of!(playdate_graphics, setFont) - 72usize];
604 ["Offset of field: playdate_graphics::setTextTracking"]
605 [::core::mem::offset_of!(playdate_graphics, setTextTracking) - 80usize];
606 ["Offset of field: playdate_graphics::pushContext"]
607 [::core::mem::offset_of!(playdate_graphics, pushContext) - 88usize];
608 ["Offset of field: playdate_graphics::popContext"]
609 [::core::mem::offset_of!(playdate_graphics, popContext) - 96usize];
610 ["Offset of field: playdate_graphics::drawBitmap"]
611 [::core::mem::offset_of!(playdate_graphics, drawBitmap) - 104usize];
612 ["Offset of field: playdate_graphics::tileBitmap"]
613 [::core::mem::offset_of!(playdate_graphics, tileBitmap) - 112usize];
614 ["Offset of field: playdate_graphics::drawLine"]
615 [::core::mem::offset_of!(playdate_graphics, drawLine) - 120usize];
616 ["Offset of field: playdate_graphics::fillTriangle"]
617 [::core::mem::offset_of!(playdate_graphics, fillTriangle) - 128usize];
618 ["Offset of field: playdate_graphics::drawRect"]
619 [::core::mem::offset_of!(playdate_graphics, drawRect) - 136usize];
620 ["Offset of field: playdate_graphics::fillRect"]
621 [::core::mem::offset_of!(playdate_graphics, fillRect) - 144usize];
622 ["Offset of field: playdate_graphics::drawEllipse"]
623 [::core::mem::offset_of!(playdate_graphics, drawEllipse) - 152usize];
624 ["Offset of field: playdate_graphics::fillEllipse"]
625 [::core::mem::offset_of!(playdate_graphics, fillEllipse) - 160usize];
626 ["Offset of field: playdate_graphics::drawScaledBitmap"]
627 [::core::mem::offset_of!(playdate_graphics, drawScaledBitmap) - 168usize];
628 ["Offset of field: playdate_graphics::drawText"]
629 [::core::mem::offset_of!(playdate_graphics, drawText) - 176usize];
630 ["Offset of field: playdate_graphics::newBitmap"]
631 [::core::mem::offset_of!(playdate_graphics, newBitmap) - 184usize];
632 ["Offset of field: playdate_graphics::freeBitmap"]
633 [::core::mem::offset_of!(playdate_graphics, freeBitmap) - 192usize];
634 ["Offset of field: playdate_graphics::loadBitmap"]
635 [::core::mem::offset_of!(playdate_graphics, loadBitmap) - 200usize];
636 ["Offset of field: playdate_graphics::copyBitmap"]
637 [::core::mem::offset_of!(playdate_graphics, copyBitmap) - 208usize];
638 ["Offset of field: playdate_graphics::loadIntoBitmap"]
639 [::core::mem::offset_of!(playdate_graphics, loadIntoBitmap) - 216usize];
640 ["Offset of field: playdate_graphics::getBitmapData"]
641 [::core::mem::offset_of!(playdate_graphics, getBitmapData) - 224usize];
642 ["Offset of field: playdate_graphics::clearBitmap"]
643 [::core::mem::offset_of!(playdate_graphics, clearBitmap) - 232usize];
644 ["Offset of field: playdate_graphics::rotatedBitmap"]
645 [::core::mem::offset_of!(playdate_graphics, rotatedBitmap) - 240usize];
646 ["Offset of field: playdate_graphics::newBitmapTable"]
647 [::core::mem::offset_of!(playdate_graphics, newBitmapTable) - 248usize];
648 ["Offset of field: playdate_graphics::freeBitmapTable"]
649 [::core::mem::offset_of!(playdate_graphics, freeBitmapTable) - 256usize];
650 ["Offset of field: playdate_graphics::loadBitmapTable"]
651 [::core::mem::offset_of!(playdate_graphics, loadBitmapTable) - 264usize];
652 ["Offset of field: playdate_graphics::loadIntoBitmapTable"]
653 [::core::mem::offset_of!(playdate_graphics, loadIntoBitmapTable) - 272usize];
654 ["Offset of field: playdate_graphics::getTableBitmap"]
655 [::core::mem::offset_of!(playdate_graphics, getTableBitmap) - 280usize];
656 ["Offset of field: playdate_graphics::loadFont"]
657 [::core::mem::offset_of!(playdate_graphics, loadFont) - 288usize];
658 ["Offset of field: playdate_graphics::getFontPage"]
659 [::core::mem::offset_of!(playdate_graphics, getFontPage) - 296usize];
660 ["Offset of field: playdate_graphics::getPageGlyph"]
661 [::core::mem::offset_of!(playdate_graphics, getPageGlyph) - 304usize];
662 ["Offset of field: playdate_graphics::getGlyphKerning"]
663 [::core::mem::offset_of!(playdate_graphics, getGlyphKerning) - 312usize];
664 ["Offset of field: playdate_graphics::getTextWidth"]
665 [::core::mem::offset_of!(playdate_graphics, getTextWidth) - 320usize];
666 ["Offset of field: playdate_graphics::getFrame"]
667 [::core::mem::offset_of!(playdate_graphics, getFrame) - 328usize];
668 ["Offset of field: playdate_graphics::getDisplayFrame"]
669 [::core::mem::offset_of!(playdate_graphics, getDisplayFrame) - 336usize];
670 ["Offset of field: playdate_graphics::getDebugBitmap"]
671 [::core::mem::offset_of!(playdate_graphics, getDebugBitmap) - 344usize];
672 ["Offset of field: playdate_graphics::copyFrameBufferBitmap"]
673 [::core::mem::offset_of!(playdate_graphics, copyFrameBufferBitmap) - 352usize];
674 ["Offset of field: playdate_graphics::markUpdatedRows"]
675 [::core::mem::offset_of!(playdate_graphics, markUpdatedRows) - 360usize];
676 ["Offset of field: playdate_graphics::display"]
677 [::core::mem::offset_of!(playdate_graphics, display) - 368usize];
678 ["Offset of field: playdate_graphics::setColorToPattern"]
679 [::core::mem::offset_of!(playdate_graphics, setColorToPattern) - 376usize];
680 ["Offset of field: playdate_graphics::checkMaskCollision"]
681 [::core::mem::offset_of!(playdate_graphics, checkMaskCollision) - 384usize];
682 ["Offset of field: playdate_graphics::setScreenClipRect"]
683 [::core::mem::offset_of!(playdate_graphics, setScreenClipRect) - 392usize];
684 ["Offset of field: playdate_graphics::fillPolygon"]
685 [::core::mem::offset_of!(playdate_graphics, fillPolygon) - 400usize];
686 ["Offset of field: playdate_graphics::getFontHeight"]
687 [::core::mem::offset_of!(playdate_graphics, getFontHeight) - 408usize];
688 ["Offset of field: playdate_graphics::getDisplayBufferBitmap"]
689 [::core::mem::offset_of!(playdate_graphics, getDisplayBufferBitmap) - 416usize];
690 ["Offset of field: playdate_graphics::drawRotatedBitmap"]
691 [::core::mem::offset_of!(playdate_graphics, drawRotatedBitmap) - 424usize];
692 ["Offset of field: playdate_graphics::setTextLeading"]
693 [::core::mem::offset_of!(playdate_graphics, setTextLeading) - 432usize];
694 ["Offset of field: playdate_graphics::setBitmapMask"]
695 [::core::mem::offset_of!(playdate_graphics, setBitmapMask) - 440usize];
696 ["Offset of field: playdate_graphics::getBitmapMask"]
697 [::core::mem::offset_of!(playdate_graphics, getBitmapMask) - 448usize];
698 ["Offset of field: playdate_graphics::setStencilImage"]
699 [::core::mem::offset_of!(playdate_graphics, setStencilImage) - 456usize];
700 ["Offset of field: playdate_graphics::makeFontFromData"]
701 [::core::mem::offset_of!(playdate_graphics, makeFontFromData) - 464usize];
702 ["Offset of field: playdate_graphics::getTextTracking"]
703 [::core::mem::offset_of!(playdate_graphics, getTextTracking) - 472usize];
704 ["Offset of field: playdate_graphics::setPixel"]
705 [::core::mem::offset_of!(playdate_graphics, setPixel) - 480usize];
706 ["Offset of field: playdate_graphics::getBitmapPixel"]
707 [::core::mem::offset_of!(playdate_graphics, getBitmapPixel) - 488usize];
708 ["Offset of field: playdate_graphics::getBitmapTableInfo"]
709 [::core::mem::offset_of!(playdate_graphics, getBitmapTableInfo) - 496usize];
710 ["Offset of field: playdate_graphics::drawTextInRect"]
711 [::core::mem::offset_of!(playdate_graphics, drawTextInRect) - 504usize];
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 = __builtin_va_list;
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 u32);
763#[repr(u32)]
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(u32)]
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 : * mut 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>() - 352usize];
826 ["Alignment of playdate_sys"][::core::mem::align_of::<playdate_sys>() - 8usize];
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) - 8usize];
829 ["Offset of field: playdate_sys::logToConsole"][::core::mem::offset_of!(playdate_sys, logToConsole) - 16usize];
830 ["Offset of field: playdate_sys::error"][::core::mem::offset_of!(playdate_sys, error) - 24usize];
831 ["Offset of field: playdate_sys::getLanguage"][::core::mem::offset_of!(playdate_sys, getLanguage) - 32usize];
832 ["Offset of field: playdate_sys::getCurrentTimeMilliseconds"]
833 [::core::mem::offset_of!(playdate_sys, getCurrentTimeMilliseconds) - 40usize];
834 ["Offset of field: playdate_sys::getSecondsSinceEpoch"]
835 [::core::mem::offset_of!(playdate_sys, getSecondsSinceEpoch) - 48usize];
836 ["Offset of field: playdate_sys::drawFPS"][::core::mem::offset_of!(playdate_sys, drawFPS) - 56usize];
837 ["Offset of field: playdate_sys::setUpdateCallback"]
838 [::core::mem::offset_of!(playdate_sys, setUpdateCallback) - 64usize];
839 ["Offset of field: playdate_sys::getButtonState"]
840 [::core::mem::offset_of!(playdate_sys, getButtonState) - 72usize];
841 ["Offset of field: playdate_sys::setPeripheralsEnabled"]
842 [::core::mem::offset_of!(playdate_sys, setPeripheralsEnabled) - 80usize];
843 ["Offset of field: playdate_sys::getAccelerometer"]
844 [::core::mem::offset_of!(playdate_sys, getAccelerometer) - 88usize];
845 ["Offset of field: playdate_sys::getCrankChange"]
846 [::core::mem::offset_of!(playdate_sys, getCrankChange) - 96usize];
847 ["Offset of field: playdate_sys::getCrankAngle"]
848 [::core::mem::offset_of!(playdate_sys, getCrankAngle) - 104usize];
849 ["Offset of field: playdate_sys::isCrankDocked"]
850 [::core::mem::offset_of!(playdate_sys, isCrankDocked) - 112usize];
851 ["Offset of field: playdate_sys::setCrankSoundsDisabled"]
852 [::core::mem::offset_of!(playdate_sys, setCrankSoundsDisabled) - 120usize];
853 ["Offset of field: playdate_sys::getFlipped"][::core::mem::offset_of!(playdate_sys, getFlipped) - 128usize];
854 ["Offset of field: playdate_sys::setAutoLockDisabled"]
855 [::core::mem::offset_of!(playdate_sys, setAutoLockDisabled) - 136usize];
856 ["Offset of field: playdate_sys::setMenuImage"]
857 [::core::mem::offset_of!(playdate_sys, setMenuImage) - 144usize];
858 ["Offset of field: playdate_sys::addMenuItem"][::core::mem::offset_of!(playdate_sys, addMenuItem) - 152usize];
859 ["Offset of field: playdate_sys::addCheckmarkMenuItem"]
860 [::core::mem::offset_of!(playdate_sys, addCheckmarkMenuItem) - 160usize];
861 ["Offset of field: playdate_sys::addOptionsMenuItem"]
862 [::core::mem::offset_of!(playdate_sys, addOptionsMenuItem) - 168usize];
863 ["Offset of field: playdate_sys::removeAllMenuItems"]
864 [::core::mem::offset_of!(playdate_sys, removeAllMenuItems) - 176usize];
865 ["Offset of field: playdate_sys::removeMenuItem"]
866 [::core::mem::offset_of!(playdate_sys, removeMenuItem) - 184usize];
867 ["Offset of field: playdate_sys::getMenuItemValue"]
868 [::core::mem::offset_of!(playdate_sys, getMenuItemValue) - 192usize];
869 ["Offset of field: playdate_sys::setMenuItemValue"]
870 [::core::mem::offset_of!(playdate_sys, setMenuItemValue) - 200usize];
871 ["Offset of field: playdate_sys::getMenuItemTitle"]
872 [::core::mem::offset_of!(playdate_sys, getMenuItemTitle) - 208usize];
873 ["Offset of field: playdate_sys::setMenuItemTitle"]
874 [::core::mem::offset_of!(playdate_sys, setMenuItemTitle) - 216usize];
875 ["Offset of field: playdate_sys::getMenuItemUserdata"]
876 [::core::mem::offset_of!(playdate_sys, getMenuItemUserdata) - 224usize];
877 ["Offset of field: playdate_sys::setMenuItemUserdata"]
878 [::core::mem::offset_of!(playdate_sys, setMenuItemUserdata) - 232usize];
879 ["Offset of field: playdate_sys::getReduceFlashing"]
880 [::core::mem::offset_of!(playdate_sys, getReduceFlashing) - 240usize];
881 ["Offset of field: playdate_sys::getElapsedTime"]
882 [::core::mem::offset_of!(playdate_sys, getElapsedTime) - 248usize];
883 ["Offset of field: playdate_sys::resetElapsedTime"]
884 [::core::mem::offset_of!(playdate_sys, resetElapsedTime) - 256usize];
885 ["Offset of field: playdate_sys::getBatteryPercentage"]
886 [::core::mem::offset_of!(playdate_sys, getBatteryPercentage) - 264usize];
887 ["Offset of field: playdate_sys::getBatteryVoltage"]
888 [::core::mem::offset_of!(playdate_sys, getBatteryVoltage) - 272usize];
889 ["Offset of field: playdate_sys::getTimezoneOffset"]
890 [::core::mem::offset_of!(playdate_sys, getTimezoneOffset) - 280usize];
891 ["Offset of field: playdate_sys::shouldDisplay24HourTime"]
892 [::core::mem::offset_of!(playdate_sys, shouldDisplay24HourTime) - 288usize];
893 ["Offset of field: playdate_sys::convertEpochToDateTime"]
894 [::core::mem::offset_of!(playdate_sys, convertEpochToDateTime) - 296usize];
895 ["Offset of field: playdate_sys::convertDateTimeToEpoch"]
896 [::core::mem::offset_of!(playdate_sys, convertDateTimeToEpoch) - 304usize];
897 ["Offset of field: playdate_sys::clearICache"][::core::mem::offset_of!(playdate_sys, clearICache) - 312usize];
898 ["Offset of field: playdate_sys::setButtonCallback"]
899 [::core::mem::offset_of!(playdate_sys, setButtonCallback) - 320usize];
900 ["Offset of field: playdate_sys::setSerialMessageCallback"]
901 [::core::mem::offset_of!(playdate_sys, setSerialMessageCallback) - 328usize];
902 ["Offset of field: playdate_sys::vaFormatString"]
903 [::core::mem::offset_of!(playdate_sys, vaFormatString) - 336usize];
904 ["Offset of field: playdate_sys::parseString"][::core::mem::offset_of!(playdate_sys, parseString) - 344usize];
905};
906pub type lua_State = *mut core::ffi::c_void;
907pub type lua_CFunction = ::core::option::Option<unsafe extern "C" fn(L: *mut lua_State) -> core::ffi::c_int>;
908#[repr(C)]
909#[derive(Debug, Copy, Clone)]
910#[must_use]
911pub struct LuaUDObject {
912 _unused: [u8; 0],
913}
914#[repr(C)]
915#[derive(Debug, Copy, Clone)]
916#[must_use]
917pub struct LCDSprite {
918 _unused: [u8; 0],
919}
920#[repr(u32)]
921#[must_use]
922#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
923pub enum l_valtype {
924 kInt = 0,
925 kFloat = 1,
926 kStr = 2,
927}
928#[repr(C)]
929#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
930#[must_use]
931pub struct lua_reg {
932 pub name: *const core::ffi::c_char,
933 pub func: lua_CFunction,
934}
935#[allow(clippy::unnecessary_operation, clippy::identity_op)]
936const _: () = {
937 ["Size of lua_reg"][::core::mem::size_of::<lua_reg>() - 16usize];
938 ["Alignment of lua_reg"][::core::mem::align_of::<lua_reg>() - 8usize];
939 ["Offset of field: lua_reg::name"][::core::mem::offset_of!(lua_reg, name) - 0usize];
940 ["Offset of field: lua_reg::func"][::core::mem::offset_of!(lua_reg, func) - 8usize];
941};
942impl Default for lua_reg {
943 fn default() -> Self {
944 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
945 unsafe {
946 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
947 s.assume_init()
948 }
949 }
950}
951#[repr(u32)]
952#[must_use]
953#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
954pub enum LuaType {
955 kTypeNil = 0,
956 kTypeBool = 1,
957 kTypeInt = 2,
958 kTypeFloat = 3,
959 kTypeString = 4,
960 kTypeTable = 5,
961 kTypeFunction = 6,
962 kTypeThread = 7,
963 kTypeObject = 8,
964}
965#[repr(C)]
966#[derive(Copy, Clone)]
967#[must_use]
968pub struct lua_val {
969 pub name: *const core::ffi::c_char,
970 pub type_: l_valtype,
971 pub v: lua_val__bindgen_ty_1,
972}
973#[repr(C)]
974#[derive(Copy, Clone)]
975#[must_use]
976pub union lua_val__bindgen_ty_1 {
977 pub intval: core::ffi::c_uint,
978 pub floatval: core::ffi::c_float,
979 pub strval: *const core::ffi::c_char,
980}
981#[allow(clippy::unnecessary_operation, clippy::identity_op)]
982const _: () = {
983 ["Size of lua_val__bindgen_ty_1"][::core::mem::size_of::<lua_val__bindgen_ty_1>() - 8usize];
984 ["Alignment of lua_val__bindgen_ty_1"][::core::mem::align_of::<lua_val__bindgen_ty_1>() - 8usize];
985 ["Offset of field: lua_val__bindgen_ty_1::intval"]
986 [::core::mem::offset_of!(lua_val__bindgen_ty_1, intval) - 0usize];
987 ["Offset of field: lua_val__bindgen_ty_1::floatval"]
988 [::core::mem::offset_of!(lua_val__bindgen_ty_1, floatval) - 0usize];
989 ["Offset of field: lua_val__bindgen_ty_1::strval"]
990 [::core::mem::offset_of!(lua_val__bindgen_ty_1, strval) - 0usize];
991};
992impl Default for lua_val__bindgen_ty_1 {
993 fn default() -> Self {
994 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
995 unsafe {
996 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
997 s.assume_init()
998 }
999 }
1000}
1001#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1002const _: () = {
1003 ["Size of lua_val"][::core::mem::size_of::<lua_val>() - 24usize];
1004 ["Alignment of lua_val"][::core::mem::align_of::<lua_val>() - 8usize];
1005 ["Offset of field: lua_val::name"][::core::mem::offset_of!(lua_val, name) - 0usize];
1006 ["Offset of field: lua_val::type_"][::core::mem::offset_of!(lua_val, type_) - 8usize];
1007 ["Offset of field: lua_val::v"][::core::mem::offset_of!(lua_val, v) - 16usize];
1008};
1009impl Default for lua_val {
1010 fn default() -> Self {
1011 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1012 unsafe {
1013 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1014 s.assume_init()
1015 }
1016 }
1017}
1018#[repr(C)]
1019#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1020#[must_use]
1021pub struct playdate_lua {
1022 #[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*."]
1023 pub addFunction: ::core::option::Option<unsafe extern "C" fn(f: lua_CFunction,
1024 name: *const core::ffi::c_char,
1025 outErr: *mut *const core::ffi::c_char)
1026 -> core::ffi::c_int>,
1027 #[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."]
1028 pub registerClass: ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char,
1029 reg: *const lua_reg,
1030 vals: *const lua_val,
1031 isstatic: core::ffi::c_int,
1032 outErr: *mut *const core::ffi::c_char)
1033 -> core::ffi::c_int>,
1034 #[doc = "`void playdate->lua->pushFunction(lua_CFunction f);`\n\nPushes a [lua\\_CFunction](#f-lua.cFunction) onto the stack."]
1035 pub pushFunction: ::core::option::Option<unsafe extern "C" fn(f: lua_CFunction)>,
1036 #[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."]
1037 pub indexMetatable: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1038 #[doc = "`void playdate->lua->stop(void);`\n\nStops the run loop."]
1039 pub stop: ::core::option::Option<unsafe extern "C" fn()>,
1040 #[doc = "`void playdate->lua->start(void);`\n\nStarts the run loop back up."]
1041 pub start: ::core::option::Option<unsafe extern "C" fn()>,
1042 #[doc = "`int playdate->lua->getArgCount(void);`\n\nReturns the number of arguments passed to the function."]
1043 pub getArgCount: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1044 #[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."]
1045 pub getArgType: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1046 outClass: *mut *const core::ffi::c_char)
1047 -> LuaType>,
1048 #[doc = "`int playdate->lua->argIsNil(int pos);`\n\nReturns 1 if the argument at the given position *pos* is nil."]
1049 pub argIsNil: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1050 #[doc = "`int playdate->lua->getArgBool(int pos);`\n\nReturns one if the argument at position *pos* is true, zero if not."]
1051 pub getArgBool: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1052 #[doc = "`int playdate->lua->getArgInt(int pos);`\n\nReturns the argument at position *pos* as an int."]
1053 pub getArgInt: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_int>,
1054 #[doc = "`float playdate->lua->getArgFloat(int pos);`\n\nReturns the argument at position *pos* as a float."]
1055 pub getArgFloat: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> core::ffi::c_float>,
1056 #[doc = "`const char* playdate->lua->getArgString(int pos);`\n\nReturns the argument at position *pos* as a string."]
1057 pub getArgString:
1058 ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *const core::ffi::c_char>,
1059 #[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."]
1060 pub getArgBytes: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1061 outlen: *mut usize)
1062 -> *const core::ffi::c_char>,
1063 #[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."]
1064 pub getArgObject: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int,
1065 type_: *mut core::ffi::c_char,
1066 outud: *mut *mut LuaUDObject)
1067 -> *mut core::ffi::c_void>,
1068 #[doc = "`LCDBitmap* playdate->lua->getBitmap(int pos);`\n\nReturns the argument at position *pos* as an LCDBitmap."]
1069 pub getBitmap: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *mut LCDBitmap>,
1070 #[doc = "`LCDSprite* playdate->lua->getSprite(int pos);`\n\nReturns the argument at position *pos* as an LCDSprite."]
1071 pub getSprite: ::core::option::Option<unsafe extern "C" fn(pos: core::ffi::c_int) -> *mut LCDSprite>,
1072 #[doc = "`void playdate->lua->pushNil(void);`\n\nPushes nil onto the stack."]
1073 pub pushNil: ::core::option::Option<unsafe extern "C" fn()>,
1074 #[doc = "`void playdate->lua->pushBool(int val);`\n\nPushes the int *val* onto the stack."]
1075 pub pushBool: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_int)>,
1076 #[doc = "`void playdate->lua->pushInt(int val);`\n\nPushes the int *val* onto the stack."]
1077 pub pushInt: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_int)>,
1078 #[doc = "`void playdate->lua->pushFloat(float val);`\n\nPushes the float *val* onto the stack."]
1079 pub pushFloat: ::core::option::Option<unsafe extern "C" fn(val: core::ffi::c_float)>,
1080 #[doc = "`void playdate->lua->pushString(char* str);`\n\nPushes the string *str* onto the stack."]
1081 pub pushString: ::core::option::Option<unsafe extern "C" fn(str_: *const core::ffi::c_char)>,
1082 #[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."]
1083 pub pushBytes: ::core::option::Option<unsafe extern "C" fn(str_: *const core::ffi::c_char, len: usize)>,
1084 #[doc = "`void playdate->lua->pushBitmap(LCDBitmap* bitmap);`\n\nPushes the LCDBitmap *bitmap* onto the stack."]
1085 pub pushBitmap: ::core::option::Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap)>,
1086 #[doc = "`void playdate->lua->pushSprite(LCDSprite* sprite);`\n\nPushes the LCDSprite *sprite* onto the stack."]
1087 pub pushSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1088 #[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))."]
1089 pub pushObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut core::ffi::c_void,
1090 type_: *mut core::ffi::c_char,
1091 nValues: core::ffi::c_int)
1092 -> *mut LuaUDObject>,
1093 #[doc = "`LuaUDObject* playdate->lua->retainObject(LuaUDObject* obj);`\n\nRetains the opaque LuaUDObject *obj* and returns same."]
1094 pub retainObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject) -> *mut LuaUDObject>,
1095 #[doc = "`void playdate->lua->releaseObject(LuaUDObject* obj);`\n\nReleases the opaque LuaUDObject *obj*."]
1096 pub releaseObject: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject)>,
1097 #[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."]
1098 pub setUserValue: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: core::ffi::c_uint)>,
1099 #[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."]
1100 pub getUserValue: ::core::option::Option<unsafe extern "C" fn(obj: *mut LuaUDObject,
1101 slot: core::ffi::c_uint)
1102 -> core::ffi::c_int>,
1103 pub callFunction_deprecated:
1104 ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char, nargs: core::ffi::c_int)>,
1105 #[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."]
1106 pub callFunction: ::core::option::Option<unsafe extern "C" fn(name: *const core::ffi::c_char,
1107 nargs: core::ffi::c_int,
1108 outerr: *mut *const core::ffi::c_char)
1109 -> core::ffi::c_int>,
1110}
1111#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1112const _: () = {
1113 ["Size of playdate_lua"][::core::mem::size_of::<playdate_lua>() - 256usize];
1114 ["Alignment of playdate_lua"][::core::mem::align_of::<playdate_lua>() - 8usize];
1115 ["Offset of field: playdate_lua::addFunction"][::core::mem::offset_of!(playdate_lua, addFunction) - 0usize];
1116 ["Offset of field: playdate_lua::registerClass"]
1117 [::core::mem::offset_of!(playdate_lua, registerClass) - 8usize];
1118 ["Offset of field: playdate_lua::pushFunction"][::core::mem::offset_of!(playdate_lua, pushFunction) - 16usize];
1119 ["Offset of field: playdate_lua::indexMetatable"]
1120 [::core::mem::offset_of!(playdate_lua, indexMetatable) - 24usize];
1121 ["Offset of field: playdate_lua::stop"][::core::mem::offset_of!(playdate_lua, stop) - 32usize];
1122 ["Offset of field: playdate_lua::start"][::core::mem::offset_of!(playdate_lua, start) - 40usize];
1123 ["Offset of field: playdate_lua::getArgCount"][::core::mem::offset_of!(playdate_lua, getArgCount) - 48usize];
1124 ["Offset of field: playdate_lua::getArgType"][::core::mem::offset_of!(playdate_lua, getArgType) - 56usize];
1125 ["Offset of field: playdate_lua::argIsNil"][::core::mem::offset_of!(playdate_lua, argIsNil) - 64usize];
1126 ["Offset of field: playdate_lua::getArgBool"][::core::mem::offset_of!(playdate_lua, getArgBool) - 72usize];
1127 ["Offset of field: playdate_lua::getArgInt"][::core::mem::offset_of!(playdate_lua, getArgInt) - 80usize];
1128 ["Offset of field: playdate_lua::getArgFloat"][::core::mem::offset_of!(playdate_lua, getArgFloat) - 88usize];
1129 ["Offset of field: playdate_lua::getArgString"][::core::mem::offset_of!(playdate_lua, getArgString) - 96usize];
1130 ["Offset of field: playdate_lua::getArgBytes"][::core::mem::offset_of!(playdate_lua, getArgBytes) - 104usize];
1131 ["Offset of field: playdate_lua::getArgObject"]
1132 [::core::mem::offset_of!(playdate_lua, getArgObject) - 112usize];
1133 ["Offset of field: playdate_lua::getBitmap"][::core::mem::offset_of!(playdate_lua, getBitmap) - 120usize];
1134 ["Offset of field: playdate_lua::getSprite"][::core::mem::offset_of!(playdate_lua, getSprite) - 128usize];
1135 ["Offset of field: playdate_lua::pushNil"][::core::mem::offset_of!(playdate_lua, pushNil) - 136usize];
1136 ["Offset of field: playdate_lua::pushBool"][::core::mem::offset_of!(playdate_lua, pushBool) - 144usize];
1137 ["Offset of field: playdate_lua::pushInt"][::core::mem::offset_of!(playdate_lua, pushInt) - 152usize];
1138 ["Offset of field: playdate_lua::pushFloat"][::core::mem::offset_of!(playdate_lua, pushFloat) - 160usize];
1139 ["Offset of field: playdate_lua::pushString"][::core::mem::offset_of!(playdate_lua, pushString) - 168usize];
1140 ["Offset of field: playdate_lua::pushBytes"][::core::mem::offset_of!(playdate_lua, pushBytes) - 176usize];
1141 ["Offset of field: playdate_lua::pushBitmap"][::core::mem::offset_of!(playdate_lua, pushBitmap) - 184usize];
1142 ["Offset of field: playdate_lua::pushSprite"][::core::mem::offset_of!(playdate_lua, pushSprite) - 192usize];
1143 ["Offset of field: playdate_lua::pushObject"][::core::mem::offset_of!(playdate_lua, pushObject) - 200usize];
1144 ["Offset of field: playdate_lua::retainObject"]
1145 [::core::mem::offset_of!(playdate_lua, retainObject) - 208usize];
1146 ["Offset of field: playdate_lua::releaseObject"]
1147 [::core::mem::offset_of!(playdate_lua, releaseObject) - 216usize];
1148 ["Offset of field: playdate_lua::setUserValue"]
1149 [::core::mem::offset_of!(playdate_lua, setUserValue) - 224usize];
1150 ["Offset of field: playdate_lua::getUserValue"]
1151 [::core::mem::offset_of!(playdate_lua, getUserValue) - 232usize];
1152 ["Offset of field: playdate_lua::callFunction_deprecated"]
1153 [::core::mem::offset_of!(playdate_lua, callFunction_deprecated) - 240usize];
1154 ["Offset of field: playdate_lua::callFunction"]
1155 [::core::mem::offset_of!(playdate_lua, callFunction) - 248usize];
1156};
1157#[repr(u32)]
1158#[must_use]
1159#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1160pub enum json_value_type {
1161 kJSONNull = 0,
1162 kJSONTrue = 1,
1163 kJSONFalse = 2,
1164 kJSONInteger = 3,
1165 kJSONFloat = 4,
1166 kJSONString = 5,
1167 kJSONArray = 6,
1168 kJSONTable = 7,
1169}
1170#[repr(C)]
1171#[derive(Copy, Clone)]
1172#[must_use]
1173pub struct json_value {
1174 pub type_: core::ffi::c_char,
1175 pub data: json_value__bindgen_ty_1,
1176}
1177#[repr(C)]
1178#[derive(Copy, Clone)]
1179#[must_use]
1180pub union json_value__bindgen_ty_1 {
1181 pub intval: core::ffi::c_int,
1182 pub floatval: core::ffi::c_float,
1183 pub stringval: *mut core::ffi::c_char,
1184 pub arrayval: *mut core::ffi::c_void,
1185 pub tableval: *mut core::ffi::c_void,
1186}
1187#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1188const _: () = {
1189 ["Size of json_value__bindgen_ty_1"][::core::mem::size_of::<json_value__bindgen_ty_1>() - 8usize];
1190 ["Alignment of json_value__bindgen_ty_1"][::core::mem::align_of::<json_value__bindgen_ty_1>() - 8usize];
1191 ["Offset of field: json_value__bindgen_ty_1::intval"]
1192 [::core::mem::offset_of!(json_value__bindgen_ty_1, intval) - 0usize];
1193 ["Offset of field: json_value__bindgen_ty_1::floatval"]
1194 [::core::mem::offset_of!(json_value__bindgen_ty_1, floatval) - 0usize];
1195 ["Offset of field: json_value__bindgen_ty_1::stringval"]
1196 [::core::mem::offset_of!(json_value__bindgen_ty_1, stringval) - 0usize];
1197 ["Offset of field: json_value__bindgen_ty_1::arrayval"]
1198 [::core::mem::offset_of!(json_value__bindgen_ty_1, arrayval) - 0usize];
1199 ["Offset of field: json_value__bindgen_ty_1::tableval"]
1200 [::core::mem::offset_of!(json_value__bindgen_ty_1, tableval) - 0usize];
1201};
1202impl Default for json_value__bindgen_ty_1 {
1203 fn default() -> Self {
1204 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1205 unsafe {
1206 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1207 s.assume_init()
1208 }
1209 }
1210}
1211#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1212const _: () = {
1213 ["Size of json_value"][::core::mem::size_of::<json_value>() - 16usize];
1214 ["Alignment of json_value"][::core::mem::align_of::<json_value>() - 8usize];
1215 ["Offset of field: json_value::type_"][::core::mem::offset_of!(json_value, type_) - 0usize];
1216 ["Offset of field: json_value::data"][::core::mem::offset_of!(json_value, data) - 8usize];
1217};
1218impl Default for json_value {
1219 fn default() -> Self {
1220 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1221 unsafe {
1222 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1223 s.assume_init()
1224 }
1225 }
1226}
1227#[repr(C)]
1228#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1229#[must_use]
1230pub struct json_decoder {
1231 pub decodeError: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1232 error: *const core::ffi::c_char,
1233 linenum: core::ffi::c_int)>,
1234 pub willDecodeSublist: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1235 name: *const core::ffi::c_char,
1236 type_: json_value_type)>,
1237 pub shouldDecodeTableValueForKey: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1238 key: *const core::ffi::c_char)
1239 -> core::ffi::c_int>,
1240 pub didDecodeTableValue: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1241 key: *const core::ffi::c_char,
1242 value: json_value)>,
1243 pub shouldDecodeArrayValueAtIndex: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1244 pos: core::ffi::c_int)
1245 -> core::ffi::c_int>,
1246 pub didDecodeArrayValue: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1247 pos: core::ffi::c_int,
1248 value: json_value)>,
1249 pub didDecodeSublist: ::core::option::Option<unsafe extern "C" fn(decoder: *mut json_decoder,
1250 name: *const core::ffi::c_char,
1251 type_: json_value_type)
1252 -> *mut core::ffi::c_void>,
1253 pub userdata: *mut core::ffi::c_void,
1254 pub returnString: core::ffi::c_int,
1255 pub path: *const core::ffi::c_char,
1256}
1257#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1258const _: () = {
1259 ["Size of json_decoder"][::core::mem::size_of::<json_decoder>() - 80usize];
1260 ["Alignment of json_decoder"][::core::mem::align_of::<json_decoder>() - 8usize];
1261 ["Offset of field: json_decoder::decodeError"][::core::mem::offset_of!(json_decoder, decodeError) - 0usize];
1262 ["Offset of field: json_decoder::willDecodeSublist"]
1263 [::core::mem::offset_of!(json_decoder, willDecodeSublist) - 8usize];
1264 ["Offset of field: json_decoder::shouldDecodeTableValueForKey"]
1265 [::core::mem::offset_of!(json_decoder, shouldDecodeTableValueForKey) - 16usize];
1266 ["Offset of field: json_decoder::didDecodeTableValue"]
1267 [::core::mem::offset_of!(json_decoder, didDecodeTableValue) - 24usize];
1268 ["Offset of field: json_decoder::shouldDecodeArrayValueAtIndex"]
1269 [::core::mem::offset_of!(json_decoder, shouldDecodeArrayValueAtIndex) - 32usize];
1270 ["Offset of field: json_decoder::didDecodeArrayValue"]
1271 [::core::mem::offset_of!(json_decoder, didDecodeArrayValue) - 40usize];
1272 ["Offset of field: json_decoder::didDecodeSublist"]
1273 [::core::mem::offset_of!(json_decoder, didDecodeSublist) - 48usize];
1274 ["Offset of field: json_decoder::userdata"][::core::mem::offset_of!(json_decoder, userdata) - 56usize];
1275 ["Offset of field: json_decoder::returnString"][::core::mem::offset_of!(json_decoder, returnString) - 64usize];
1276 ["Offset of field: json_decoder::path"][::core::mem::offset_of!(json_decoder, path) - 72usize];
1277};
1278impl Default for json_decoder {
1279 fn default() -> Self {
1280 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1281 unsafe {
1282 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1283 s.assume_init()
1284 }
1285 }
1286}
1287pub type json_readFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
1288 buf: *mut u8,
1289 bufsize: core::ffi::c_int)
1290 -> core::ffi::c_int>;
1291#[repr(C)]
1292#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1293#[must_use]
1294pub struct json_reader {
1295 pub read: json_readFunc,
1296 pub userdata: *mut core::ffi::c_void,
1297}
1298#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1299const _: () = {
1300 ["Size of json_reader"][::core::mem::size_of::<json_reader>() - 16usize];
1301 ["Alignment of json_reader"][::core::mem::align_of::<json_reader>() - 8usize];
1302 ["Offset of field: json_reader::read"][::core::mem::offset_of!(json_reader, read) - 0usize];
1303 ["Offset of field: json_reader::userdata"][::core::mem::offset_of!(json_reader, userdata) - 8usize];
1304};
1305impl Default for json_reader {
1306 fn default() -> Self {
1307 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1308 unsafe {
1309 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1310 s.assume_init()
1311 }
1312 }
1313}
1314pub type json_writeFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
1315 str_: *const core::ffi::c_char,
1316 len: core::ffi::c_int)>;
1317#[repr(C)]
1318#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1319#[must_use]
1320pub struct json_encoder {
1321 pub writeStringFunc: json_writeFunc,
1322 pub userdata: *mut core::ffi::c_void,
1323 pub _bitfield_align_1: [u32; 0],
1324 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
1325 pub startArray: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1326 pub addArrayMember: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1327 pub endArray: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1328 pub startTable: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1329 pub addTableMember: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1330 name: *const core::ffi::c_char,
1331 len: core::ffi::c_int)>,
1332 pub endTable: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1333 pub writeNull: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1334 pub writeFalse: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1335 pub writeTrue: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder)>,
1336 pub writeInt: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder, num: core::ffi::c_int)>,
1337 pub writeDouble:
1338 ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder, num: core::ffi::c_double)>,
1339 pub writeString: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1340 str_: *const core::ffi::c_char,
1341 len: core::ffi::c_int)>,
1342}
1343#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1344const _: () = {
1345 ["Size of json_encoder"][::core::mem::size_of::<json_encoder>() - 120usize];
1346 ["Alignment of json_encoder"][::core::mem::align_of::<json_encoder>() - 8usize];
1347 ["Offset of field: json_encoder::writeStringFunc"]
1348 [::core::mem::offset_of!(json_encoder, writeStringFunc) - 0usize];
1349 ["Offset of field: json_encoder::userdata"][::core::mem::offset_of!(json_encoder, userdata) - 8usize];
1350 ["Offset of field: json_encoder::startArray"][::core::mem::offset_of!(json_encoder, startArray) - 24usize];
1351 ["Offset of field: json_encoder::addArrayMember"]
1352 [::core::mem::offset_of!(json_encoder, addArrayMember) - 32usize];
1353 ["Offset of field: json_encoder::endArray"][::core::mem::offset_of!(json_encoder, endArray) - 40usize];
1354 ["Offset of field: json_encoder::startTable"][::core::mem::offset_of!(json_encoder, startTable) - 48usize];
1355 ["Offset of field: json_encoder::addTableMember"]
1356 [::core::mem::offset_of!(json_encoder, addTableMember) - 56usize];
1357 ["Offset of field: json_encoder::endTable"][::core::mem::offset_of!(json_encoder, endTable) - 64usize];
1358 ["Offset of field: json_encoder::writeNull"][::core::mem::offset_of!(json_encoder, writeNull) - 72usize];
1359 ["Offset of field: json_encoder::writeFalse"][::core::mem::offset_of!(json_encoder, writeFalse) - 80usize];
1360 ["Offset of field: json_encoder::writeTrue"][::core::mem::offset_of!(json_encoder, writeTrue) - 88usize];
1361 ["Offset of field: json_encoder::writeInt"][::core::mem::offset_of!(json_encoder, writeInt) - 96usize];
1362 ["Offset of field: json_encoder::writeDouble"][::core::mem::offset_of!(json_encoder, writeDouble) - 104usize];
1363 ["Offset of field: json_encoder::writeString"][::core::mem::offset_of!(json_encoder, writeString) - 112usize];
1364};
1365impl Default for json_encoder {
1366 fn default() -> Self {
1367 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1368 unsafe {
1369 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1370 s.assume_init()
1371 }
1372 }
1373}
1374impl json_encoder {
1375 #[inline]
1376 pub fn pretty(&self) -> core::ffi::c_int {
1377 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
1378 }
1379 #[inline]
1380 pub fn set_pretty(&mut self, val: core::ffi::c_int) {
1381 unsafe {
1382 let val: u32 = ::core::mem::transmute(val);
1383 self._bitfield_1.set(0usize, 1u8, val as u64)
1384 }
1385 }
1386 #[inline]
1387 pub unsafe fn pretty_raw(this: *const Self) -> core::ffi::c_int {
1388 unsafe {
1389 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 0usize , 1u8 ,) as u32)
1390 }
1391 }
1392 #[inline]
1393 pub unsafe fn set_pretty_raw(this: *mut Self, val: core::ffi::c_int) {
1394 unsafe {
1395 let val: u32 = ::core::mem::transmute(val);
1396 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1397 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1398 0usize,
1399 1u8,
1400 val as u64,
1401 )
1402 }
1403 }
1404 #[inline]
1405 pub fn startedTable(&self) -> core::ffi::c_int {
1406 unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
1407 }
1408 #[inline]
1409 pub fn set_startedTable(&mut self, val: core::ffi::c_int) {
1410 unsafe {
1411 let val: u32 = ::core::mem::transmute(val);
1412 self._bitfield_1.set(1usize, 1u8, val as u64)
1413 }
1414 }
1415 #[inline]
1416 pub unsafe fn startedTable_raw(this: *const Self) -> core::ffi::c_int {
1417 unsafe {
1418 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 1usize , 1u8 ,) as u32)
1419 }
1420 }
1421 #[inline]
1422 pub unsafe fn set_startedTable_raw(this: *mut Self, val: core::ffi::c_int) {
1423 unsafe {
1424 let val: u32 = ::core::mem::transmute(val);
1425 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1426 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1427 1usize,
1428 1u8,
1429 val as u64,
1430 )
1431 }
1432 }
1433 #[inline]
1434 pub fn startedArray(&self) -> core::ffi::c_int {
1435 unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) }
1436 }
1437 #[inline]
1438 pub fn set_startedArray(&mut self, val: core::ffi::c_int) {
1439 unsafe {
1440 let val: u32 = ::core::mem::transmute(val);
1441 self._bitfield_1.set(2usize, 1u8, val as u64)
1442 }
1443 }
1444 #[inline]
1445 pub unsafe fn startedArray_raw(this: *const Self) -> core::ffi::c_int {
1446 unsafe {
1447 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 2usize , 1u8 ,) as u32)
1448 }
1449 }
1450 #[inline]
1451 pub unsafe fn set_startedArray_raw(this: *mut Self, val: core::ffi::c_int) {
1452 unsafe {
1453 let val: u32 = ::core::mem::transmute(val);
1454 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1455 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1456 2usize,
1457 1u8,
1458 val as u64,
1459 )
1460 }
1461 }
1462 #[inline]
1463 pub fn depth(&self) -> core::ffi::c_int {
1464 unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 29u8) as u32) }
1465 }
1466 #[inline]
1467 pub fn set_depth(&mut self, val: core::ffi::c_int) {
1468 unsafe {
1469 let val: u32 = ::core::mem::transmute(val);
1470 self._bitfield_1.set(3usize, 29u8, val as u64)
1471 }
1472 }
1473 #[inline]
1474 pub unsafe fn depth_raw(this: *const Self) -> core::ffi::c_int {
1475 unsafe {
1476 :: core :: mem :: transmute (< __BindgenBitfieldUnit < [u8 ; 4usize] > > :: raw_get (:: core :: ptr :: addr_of ! ((* this) . _bitfield_1) , 3usize , 29u8 ,) as u32)
1477 }
1478 }
1479 #[inline]
1480 pub unsafe fn set_depth_raw(this: *mut Self, val: core::ffi::c_int) {
1481 unsafe {
1482 let val: u32 = ::core::mem::transmute(val);
1483 <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
1484 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
1485 3usize,
1486 29u8,
1487 val as u64,
1488 )
1489 }
1490 }
1491 #[inline]
1492 pub fn new_bitfield_1(pretty: core::ffi::c_int,
1493 startedTable: core::ffi::c_int,
1494 startedArray: core::ffi::c_int,
1495 depth: core::ffi::c_int)
1496 -> __BindgenBitfieldUnit<[u8; 4usize]> {
1497 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
1498 __bindgen_bitfield_unit.set(0usize, 1u8, {
1499 let pretty: u32 = unsafe { ::core::mem::transmute(pretty) };
1500 pretty as u64
1501 });
1502 __bindgen_bitfield_unit.set(1usize, 1u8, {
1503 let startedTable: u32 = unsafe { ::core::mem::transmute(startedTable) };
1504 startedTable as u64
1505 });
1506 __bindgen_bitfield_unit.set(2usize, 1u8, {
1507 let startedArray: u32 = unsafe { ::core::mem::transmute(startedArray) };
1508 startedArray as u64
1509 });
1510 __bindgen_bitfield_unit.set(3usize, 29u8, {
1511 let depth: u32 = unsafe { ::core::mem::transmute(depth) };
1512 depth as u64
1513 });
1514 __bindgen_bitfield_unit
1515 }
1516}
1517#[repr(C)]
1518#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1519#[must_use]
1520pub struct playdate_json {
1521 #[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."]
1522 pub initEncoder: ::core::option::Option<unsafe extern "C" fn(encoder: *mut json_encoder,
1523 write: json_writeFunc,
1524 userdata: *mut core::ffi::c_void,
1525 pretty: core::ffi::c_int)>,
1526 #[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."]
1527 pub decode: ::core::option::Option<unsafe extern "C" fn(functions: *mut json_decoder,
1528 reader: json_reader,
1529 outval: *mut json_value)
1530 -> core::ffi::c_int>,
1531 #[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."]
1532 pub decodeString: ::core::option::Option<unsafe extern "C" fn(functions: *mut json_decoder,
1533 jsonString: *const core::ffi::c_char,
1534 outval: *mut json_value)
1535 -> core::ffi::c_int>,
1536}
1537#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1538const _: () = {
1539 ["Size of playdate_json"][::core::mem::size_of::<playdate_json>() - 24usize];
1540 ["Alignment of playdate_json"][::core::mem::align_of::<playdate_json>() - 8usize];
1541 ["Offset of field: playdate_json::initEncoder"][::core::mem::offset_of!(playdate_json, initEncoder) - 0usize];
1542 ["Offset of field: playdate_json::decode"][::core::mem::offset_of!(playdate_json, decode) - 8usize];
1543 ["Offset of field: playdate_json::decodeString"]
1544 [::core::mem::offset_of!(playdate_json, decodeString) - 16usize];
1545};
1546pub type SDFile = core::ffi::c_void;
1547impl FileOptions {
1548 pub const kFileRead: FileOptions = FileOptions(1);
1549}
1550impl FileOptions {
1551 pub const kFileReadData: FileOptions = FileOptions(2);
1552}
1553impl FileOptions {
1554 pub const kFileWrite: FileOptions = FileOptions(4);
1555}
1556impl FileOptions {
1557 pub const kFileAppend: FileOptions = FileOptions(8);
1558}
1559impl ::core::ops::BitOr<FileOptions> for FileOptions {
1560 type Output = Self;
1561 #[inline]
1562 fn bitor(self, other: Self) -> Self { FileOptions(self.0 | other.0) }
1563}
1564impl ::core::ops::BitOrAssign for FileOptions {
1565 #[inline]
1566 fn bitor_assign(&mut self, rhs: FileOptions) { self.0 |= rhs.0; }
1567}
1568impl ::core::ops::BitAnd<FileOptions> for FileOptions {
1569 type Output = Self;
1570 #[inline]
1571 fn bitand(self, other: Self) -> Self { FileOptions(self.0 & other.0) }
1572}
1573impl ::core::ops::BitAndAssign for FileOptions {
1574 #[inline]
1575 fn bitand_assign(&mut self, rhs: FileOptions) { self.0 &= rhs.0; }
1576}
1577#[repr(transparent)]
1578#[must_use]
1579#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1580pub struct FileOptions(pub u32);
1581#[repr(C)]
1582#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1583#[must_use]
1584pub struct FileStat {
1585 pub isdir: core::ffi::c_int,
1586 pub size: core::ffi::c_uint,
1587 pub m_year: core::ffi::c_int,
1588 pub m_month: core::ffi::c_int,
1589 pub m_day: core::ffi::c_int,
1590 pub m_hour: core::ffi::c_int,
1591 pub m_minute: core::ffi::c_int,
1592 pub m_second: core::ffi::c_int,
1593}
1594#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1595const _: () = {
1596 ["Size of FileStat"][::core::mem::size_of::<FileStat>() - 32usize];
1597 ["Alignment of FileStat"][::core::mem::align_of::<FileStat>() - 4usize];
1598 ["Offset of field: FileStat::isdir"][::core::mem::offset_of!(FileStat, isdir) - 0usize];
1599 ["Offset of field: FileStat::size"][::core::mem::offset_of!(FileStat, size) - 4usize];
1600 ["Offset of field: FileStat::m_year"][::core::mem::offset_of!(FileStat, m_year) - 8usize];
1601 ["Offset of field: FileStat::m_month"][::core::mem::offset_of!(FileStat, m_month) - 12usize];
1602 ["Offset of field: FileStat::m_day"][::core::mem::offset_of!(FileStat, m_day) - 16usize];
1603 ["Offset of field: FileStat::m_hour"][::core::mem::offset_of!(FileStat, m_hour) - 20usize];
1604 ["Offset of field: FileStat::m_minute"][::core::mem::offset_of!(FileStat, m_minute) - 24usize];
1605 ["Offset of field: FileStat::m_second"][::core::mem::offset_of!(FileStat, m_second) - 28usize];
1606};
1607#[repr(C)]
1608#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1609#[must_use]
1610pub 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 > , }
1611#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1612const _: () = {
1613 ["Size of playdate_file"][::core::mem::size_of::<playdate_file>() - 104usize];
1614 ["Alignment of playdate_file"][::core::mem::align_of::<playdate_file>() - 8usize];
1615 ["Offset of field: playdate_file::geterr"][::core::mem::offset_of!(playdate_file, geterr) - 0usize];
1616 ["Offset of field: playdate_file::listfiles"][::core::mem::offset_of!(playdate_file, listfiles) - 8usize];
1617 ["Offset of field: playdate_file::stat"][::core::mem::offset_of!(playdate_file, stat) - 16usize];
1618 ["Offset of field: playdate_file::mkdir"][::core::mem::offset_of!(playdate_file, mkdir) - 24usize];
1619 ["Offset of field: playdate_file::unlink"][::core::mem::offset_of!(playdate_file, unlink) - 32usize];
1620 ["Offset of field: playdate_file::rename"][::core::mem::offset_of!(playdate_file, rename) - 40usize];
1621 ["Offset of field: playdate_file::open"][::core::mem::offset_of!(playdate_file, open) - 48usize];
1622 ["Offset of field: playdate_file::close"][::core::mem::offset_of!(playdate_file, close) - 56usize];
1623 ["Offset of field: playdate_file::read"][::core::mem::offset_of!(playdate_file, read) - 64usize];
1624 ["Offset of field: playdate_file::write"][::core::mem::offset_of!(playdate_file, write) - 72usize];
1625 ["Offset of field: playdate_file::flush"][::core::mem::offset_of!(playdate_file, flush) - 80usize];
1626 ["Offset of field: playdate_file::tell"][::core::mem::offset_of!(playdate_file, tell) - 88usize];
1627 ["Offset of field: playdate_file::seek"][::core::mem::offset_of!(playdate_file, seek) - 96usize];
1628};
1629#[repr(u32)]
1630#[must_use]
1631#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1632pub enum SpriteCollisionResponseType {
1633 kCollisionTypeSlide = 0,
1634 kCollisionTypeFreeze = 1,
1635 kCollisionTypeOverlap = 2,
1636 kCollisionTypeBounce = 3,
1637}
1638#[repr(C)]
1639#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
1640#[must_use]
1641pub struct PDRect {
1642 pub x: core::ffi::c_float,
1643 pub y: core::ffi::c_float,
1644 pub width: core::ffi::c_float,
1645 pub height: core::ffi::c_float,
1646}
1647#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1648const _: () = {
1649 ["Size of PDRect"][::core::mem::size_of::<PDRect>() - 16usize];
1650 ["Alignment of PDRect"][::core::mem::align_of::<PDRect>() - 4usize];
1651 ["Offset of field: PDRect::x"][::core::mem::offset_of!(PDRect, x) - 0usize];
1652 ["Offset of field: PDRect::y"][::core::mem::offset_of!(PDRect, y) - 4usize];
1653 ["Offset of field: PDRect::width"][::core::mem::offset_of!(PDRect, width) - 8usize];
1654 ["Offset of field: PDRect::height"][::core::mem::offset_of!(PDRect, height) - 12usize];
1655};
1656#[repr(C)]
1657#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
1658#[must_use]
1659pub struct CollisionPoint {
1660 pub x: core::ffi::c_float,
1661 pub y: core::ffi::c_float,
1662}
1663#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1664const _: () = {
1665 ["Size of CollisionPoint"][::core::mem::size_of::<CollisionPoint>() - 8usize];
1666 ["Alignment of CollisionPoint"][::core::mem::align_of::<CollisionPoint>() - 4usize];
1667 ["Offset of field: CollisionPoint::x"][::core::mem::offset_of!(CollisionPoint, x) - 0usize];
1668 ["Offset of field: CollisionPoint::y"][::core::mem::offset_of!(CollisionPoint, y) - 4usize];
1669};
1670#[repr(C)]
1671#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1672#[must_use]
1673pub struct CollisionVector {
1674 pub x: core::ffi::c_int,
1675 pub y: core::ffi::c_int,
1676}
1677#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1678const _: () = {
1679 ["Size of CollisionVector"][::core::mem::size_of::<CollisionVector>() - 8usize];
1680 ["Alignment of CollisionVector"][::core::mem::align_of::<CollisionVector>() - 4usize];
1681 ["Offset of field: CollisionVector::x"][::core::mem::offset_of!(CollisionVector, x) - 0usize];
1682 ["Offset of field: CollisionVector::y"][::core::mem::offset_of!(CollisionVector, y) - 4usize];
1683};
1684#[repr(C)]
1685#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
1686#[must_use]
1687pub struct SpriteCollisionInfo {
1688 pub sprite: *mut LCDSprite,
1689 pub other: *mut LCDSprite,
1690 pub responseType: SpriteCollisionResponseType,
1691 pub overlaps: u8,
1692 pub ti: core::ffi::c_float,
1693 pub move_: CollisionPoint,
1694 pub normal: CollisionVector,
1695 pub touch: CollisionPoint,
1696 pub spriteRect: PDRect,
1697 pub otherRect: PDRect,
1698}
1699#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1700const _: () = {
1701 ["Size of SpriteCollisionInfo"][::core::mem::size_of::<SpriteCollisionInfo>() - 88usize];
1702 ["Alignment of SpriteCollisionInfo"][::core::mem::align_of::<SpriteCollisionInfo>() - 8usize];
1703 ["Offset of field: SpriteCollisionInfo::sprite"]
1704 [::core::mem::offset_of!(SpriteCollisionInfo, sprite) - 0usize];
1705 ["Offset of field: SpriteCollisionInfo::other"][::core::mem::offset_of!(SpriteCollisionInfo, other) - 8usize];
1706 ["Offset of field: SpriteCollisionInfo::responseType"]
1707 [::core::mem::offset_of!(SpriteCollisionInfo, responseType) - 16usize];
1708 ["Offset of field: SpriteCollisionInfo::overlaps"]
1709 [::core::mem::offset_of!(SpriteCollisionInfo, overlaps) - 20usize];
1710 ["Offset of field: SpriteCollisionInfo::ti"][::core::mem::offset_of!(SpriteCollisionInfo, ti) - 24usize];
1711 ["Offset of field: SpriteCollisionInfo::move_"][::core::mem::offset_of!(SpriteCollisionInfo, move_) - 28usize];
1712 ["Offset of field: SpriteCollisionInfo::normal"]
1713 [::core::mem::offset_of!(SpriteCollisionInfo, normal) - 36usize];
1714 ["Offset of field: SpriteCollisionInfo::touch"][::core::mem::offset_of!(SpriteCollisionInfo, touch) - 44usize];
1715 ["Offset of field: SpriteCollisionInfo::spriteRect"]
1716 [::core::mem::offset_of!(SpriteCollisionInfo, spriteRect) - 52usize];
1717 ["Offset of field: SpriteCollisionInfo::otherRect"]
1718 [::core::mem::offset_of!(SpriteCollisionInfo, otherRect) - 68usize];
1719};
1720impl Default for SpriteCollisionInfo {
1721 fn default() -> Self {
1722 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1723 unsafe {
1724 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1725 s.assume_init()
1726 }
1727 }
1728}
1729#[repr(C)]
1730#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
1731#[must_use]
1732pub struct SpriteQueryInfo {
1733 pub sprite: *mut LCDSprite,
1734 pub ti1: core::ffi::c_float,
1735 pub ti2: core::ffi::c_float,
1736 pub entryPoint: CollisionPoint,
1737 pub exitPoint: CollisionPoint,
1738}
1739#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1740const _: () = {
1741 ["Size of SpriteQueryInfo"][::core::mem::size_of::<SpriteQueryInfo>() - 32usize];
1742 ["Alignment of SpriteQueryInfo"][::core::mem::align_of::<SpriteQueryInfo>() - 8usize];
1743 ["Offset of field: SpriteQueryInfo::sprite"][::core::mem::offset_of!(SpriteQueryInfo, sprite) - 0usize];
1744 ["Offset of field: SpriteQueryInfo::ti1"][::core::mem::offset_of!(SpriteQueryInfo, ti1) - 8usize];
1745 ["Offset of field: SpriteQueryInfo::ti2"][::core::mem::offset_of!(SpriteQueryInfo, ti2) - 12usize];
1746 ["Offset of field: SpriteQueryInfo::entryPoint"]
1747 [::core::mem::offset_of!(SpriteQueryInfo, entryPoint) - 16usize];
1748 ["Offset of field: SpriteQueryInfo::exitPoint"][::core::mem::offset_of!(SpriteQueryInfo, exitPoint) - 24usize];
1749};
1750impl Default for SpriteQueryInfo {
1751 fn default() -> Self {
1752 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
1753 unsafe {
1754 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1755 s.assume_init()
1756 }
1757 }
1758}
1759pub type LCDSpriteDrawFunction =
1760 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, bounds: PDRect, drawrect: PDRect)>;
1761pub type LCDSpriteUpdateFunction = ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>;
1762pub type LCDSpriteCollisionFilterProc =
1763 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1764 other: *mut LCDSprite)
1765 -> SpriteCollisionResponseType>;
1766#[repr(C)]
1767#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
1768#[must_use]
1769pub struct playdate_sprite {
1770 #[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."]
1771 pub setAlwaysRedraw: ::core::option::Option<unsafe extern "C" fn(flag: core::ffi::c_int)>,
1772 #[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."]
1773 pub addDirtyRect: ::core::option::Option<unsafe extern "C" fn(dirtyRect: LCDRect)>,
1774 #[doc = "`void playdate->sprite->drawSprites(void);`\n\nDraws every sprite in the display list."]
1775 pub drawSprites: ::core::option::Option<unsafe extern "C" fn()>,
1776 #[doc = "`void playdate->sprite->updateAndDrawSprites(void);`\n\nUpdates and draws every sprite in the display list."]
1777 pub updateAndDrawSprites: ::core::option::Option<unsafe extern "C" fn()>,
1778 #[doc = "`LCDSprite* playdate->sprite->newSprite(void);`\n\nAllocates and returns a new LCDSprite."]
1779 pub newSprite: ::core::option::Option<unsafe extern "C" fn() -> *mut LCDSprite>,
1780 pub freeSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1781 #[doc = "`LCDSprite* playdate->sprite->copy(LCDSprite *sprite);`\n\nAllocates and returns a copy of the given *sprite*."]
1782 pub copy: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut LCDSprite>,
1783 #[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."]
1784 pub addSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1785 #[doc = "`void playdate->sprite->removeSprite(LCDSprite *sprite);`\n\nRemoves the given *sprite* from the display list."]
1786 pub removeSprite: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1787 #[doc = "`void playdate->sprite->removeSprites(LCDSprite **sprites, int count);`\n\nRemoves the given *count* sized array of *sprites* from the display list."]
1788 pub removeSprites:
1789 ::core::option::Option<unsafe extern "C" fn(sprites: *mut *mut LCDSprite, count: core::ffi::c_int)>,
1790 #[doc = "`void playdate->sprite->removeAllSprites(void);`\n\nRemoves all sprites from the display list."]
1791 pub removeAllSprites: ::core::option::Option<unsafe extern "C" fn()>,
1792 #[doc = "`int playdate->sprite->getSpriteCount(void);`\n\nReturns the total number of sprites in the display list."]
1793 pub getSpriteCount: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
1794 #[doc = "`void playdate->sprite->setBounds(LCDSprite *sprite, PDRect bounds);`\n\nSets the bounds of the given *sprite* with *bounds*."]
1795 pub setBounds: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, bounds: PDRect)>,
1796 #[doc = "`PDRect playdate->sprite->getBounds(LCDSprite *sprite);`\n\nReturns the bounds of the given *sprite* as an PDRect;"]
1797 pub getBounds: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> PDRect>,
1798 #[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."]
1799 pub moveTo: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1800 x: core::ffi::c_float,
1801 y: core::ffi::c_float)>,
1802 #[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*."]
1803 pub moveBy: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1804 dx: core::ffi::c_float,
1805 dy: core::ffi::c_float)>,
1806 #[doc = "`void playdate->sprite->setImage(LCDSprite *sprite, LCDBitmap *image, LCDBitmapFlip flip);`\n\nSets the given *sprite*'s image to the given *bitmap*."]
1807 pub setImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1808 image: *mut LCDBitmap,
1809 flip: LCDBitmapFlip)>,
1810 #[doc = "`LCDBitmap* playdate->sprite->getImage(LCDSprite *sprite);`\n\nReturns the LCDBitmap currently assigned to the given *sprite*."]
1811 pub getImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut LCDBitmap>,
1812 #[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()."]
1813 pub setSize: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1814 width: core::ffi::c_float,
1815 height: core::ffi::c_float)>,
1816 #[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."]
1817 pub setZIndex: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, zIndex: i16)>,
1818 #[doc = "`int16_t playdate->sprite->getZIndex(LCDSprite *sprite);`\n\nReturns the Z index of the given *sprite*."]
1819 pub getZIndex: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> i16>,
1820 #[doc = "`void playdate->sprite->setDrawMode(LCDSprite *sprite, LCDBitmapDrawMode mode);`\n\nSets the mode for drawing the sprite’s bitmap."]
1821 pub setDrawMode: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, mode: LCDBitmapDrawMode)>,
1822 #[doc = "`void playdate->sprite->setImageFlip(LCDSprite *sprite, LCDBitmapFlip flip);`\n\nFlips the bitmap."]
1823 pub setImageFlip: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flip: LCDBitmapFlip)>,
1824 #[doc = "`LCDBitmapFlip playdate->sprite->getImageFlip(LCDSprite *sprite);`\n\nReturns the flip setting of the sprite’s bitmap."]
1825 pub getImageFlip: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> LCDBitmapFlip>,
1826 #[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."]
1827 pub setStencil: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, stencil: *mut LCDBitmap)>,
1828 #[doc = "`void playdate->sprite->setClipRect(LCDSprite *sprite, LCDRect clipRect);`\n\nSets the clipping rectangle for sprite drawing."]
1829 pub setClipRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, clipRect: LCDRect)>,
1830 #[doc = "`void playdate->sprite->clearClipRect(LCDSprite *sprite);`\n\nClears the sprite’s clipping rectangle."]
1831 pub clearClipRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1832 #[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."]
1833 pub setClipRectsInRange: ::core::option::Option<unsafe extern "C" fn(clipRect: LCDRect,
1834 startZ: core::ffi::c_int,
1835 endZ: core::ffi::c_int)>,
1836 #[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."]
1837 pub clearClipRectsInRange:
1838 ::core::option::Option<unsafe extern "C" fn(startZ: core::ffi::c_int, endZ: core::ffi::c_int)>,
1839 #[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."]
1840 pub setUpdatesEnabled:
1841 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1842 #[doc = "`int playdate->sprite->updatesEnabled(LCDSprite *sprite);`\n\nGet the updatesEnabled flag of the given *sprite*."]
1843 pub updatesEnabled: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1844 #[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."]
1845 pub setCollisionsEnabled:
1846 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1847 #[doc = "`int playdate->sprite->collisionsEnabled(LCDSprite *sprite);`\n\nGet the collisionsEnabled flag of the given *sprite*."]
1848 pub collisionsEnabled:
1849 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1850 #[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."]
1851 pub setVisible: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1852 #[doc = "`int playdate->sprite->isVisible(LCDSprite *sprite);`\n\nGet the visible flag of the given *sprite*."]
1853 pub isVisible: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> core::ffi::c_int>,
1854 #[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."]
1855 pub setOpaque: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1856 #[doc = "`void playdate->sprite->markDirty(LCDSprite *sprite);`\n\nForces the given *sprite* to redraw."]
1857 pub markDirty: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1858 #[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."]
1859 pub setTag: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, tag: u8)>,
1860 #[doc = "`uint8_t playdate->sprite->getTag(LCDSprite *sprite);`\n\nReturns the tag of the given *sprite*."]
1861 pub getTag: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> u8>,
1862 #[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."]
1863 pub setIgnoresDrawOffset:
1864 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, flag: core::ffi::c_int)>,
1865 #[doc = "`void playdate->sprite->setUpdateFunction(LCDSprite *sprite, LCDSpriteUpdateFunction *func);`\n\nSets the update function for the given *sprite*."]
1866 pub setUpdateFunction:
1867 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteUpdateFunction)>,
1868 #[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)."]
1869 pub setDrawFunction:
1870 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteDrawFunction)>,
1871 #[doc = "`void playdate->sprite->getPosition(LCDSprite *sprite, float *x, float *y);`\n\nSets *x* and *y* to the current position of *sprite*."]
1872 pub getPosition: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1873 x: *mut core::ffi::c_float,
1874 y: *mut core::ffi::c_float)>,
1875 #[doc = "`void playdate->sprite->resetCollisionWorld(void);`\n\nFrees and reallocates internal collision data, resetting everything to its default state."]
1876 pub resetCollisionWorld: ::core::option::Option<unsafe extern "C" fn()>,
1877 #[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."]
1878 pub setCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, collideRect: PDRect)>,
1879 #[doc = "`PDRect playdate->sprite->getCollideRect(LCDSprite *sprite);`\n\nReturns the given *sprite*’s collide rect."]
1880 pub getCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> PDRect>,
1881 #[doc = "`void playdate->sprite->clearCollideRect(LCDSprite *sprite);`\n\nClears the given *sprite*’s collide rect."]
1882 pub clearCollideRect: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1883 #[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```"]
1884 pub setCollisionResponseFunction:
1885 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, func: LCDSpriteCollisionFilterProc)>,
1886 #[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."]
1887 pub checkCollisions: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1888 goalX: core::ffi::c_float,
1889 goalY: core::ffi::c_float,
1890 actualX: *mut core::ffi::c_float,
1891 actualY: *mut core::ffi::c_float,
1892 len: *mut core::ffi::c_int)
1893 -> *mut SpriteCollisionInfo>,
1894 #[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."]
1895 pub moveWithCollisions: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1896 goalX: core::ffi::c_float,
1897 goalY: core::ffi::c_float,
1898 actualX: *mut core::ffi::c_float,
1899 actualY: *mut core::ffi::c_float,
1900 len: *mut core::ffi::c_int)
1901 -> *mut SpriteCollisionInfo>,
1902 #[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."]
1903 pub querySpritesAtPoint: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_float,
1904 y: core::ffi::c_float,
1905 len: *mut core::ffi::c_int)
1906 -> *mut *mut LCDSprite>,
1907 #[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."]
1908 pub querySpritesInRect: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_float,
1909 y: core::ffi::c_float,
1910 width: core::ffi::c_float,
1911 height: core::ffi::c_float,
1912 len: *mut core::ffi::c_int)
1913 -> *mut *mut LCDSprite>,
1914 #[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."]
1915 pub querySpritesAlongLine: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_float,
1916 y1: core::ffi::c_float,
1917 x2: core::ffi::c_float,
1918 y2: core::ffi::c_float,
1919 len: *mut core::ffi::c_int)
1920 -> *mut *mut LCDSprite>,
1921 #[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."]
1922 pub querySpriteInfoAlongLine: ::core::option::Option<unsafe extern "C" fn(x1: core::ffi::c_float,
1923 y1: core::ffi::c_float,
1924 x2: core::ffi::c_float,
1925 y2: core::ffi::c_float,
1926 len: *mut core::ffi::c_int)
1927 -> *mut SpriteQueryInfo>,
1928 #[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."]
1929 pub overlappingSprites: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1930 len: *mut core::ffi::c_int)
1931 -> *mut *mut LCDSprite>,
1932 #[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."]
1933 pub allOverlappingSprites:
1934 ::core::option::Option<unsafe extern "C" fn(len: *mut core::ffi::c_int) -> *mut *mut LCDSprite>,
1935 #[doc = "`void playdate->sprite->setStencilPattern(LCDSprite* sprite, uint8_t pattern[8]);`\n\nSets the sprite’s stencil to the given pattern."]
1936 pub setStencilPattern:
1937 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, pattern: *mut [u8; 8usize])>,
1938 #[doc = "`void playdate->sprite->clearStencil(LCDSprite *sprite);`\n\nClears the sprite’s stencil."]
1939 pub clearStencil: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
1940 #[doc = "`void playdate->sprite->setUserdata(LCDSprite *sprite, void* userdata);`"]
1941 pub setUserdata:
1942 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite, userdata: *mut core::ffi::c_void)>,
1943 #[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."]
1944 pub getUserdata:
1945 ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite) -> *mut core::ffi::c_void>,
1946 #[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."]
1947 pub setStencilImage: ::core::option::Option<unsafe extern "C" fn(sprite: *mut LCDSprite,
1948 stencil: *mut LCDBitmap,
1949 tile: core::ffi::c_int)>,
1950 #[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."]
1951 pub setCenter: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1952 x: core::ffi::c_float,
1953 y: core::ffi::c_float)>,
1954 #[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."]
1955 pub getCenter: ::core::option::Option<unsafe extern "C" fn(s: *mut LCDSprite,
1956 x: *mut core::ffi::c_float,
1957 y: *mut core::ffi::c_float)>,
1958}
1959#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1960const _: () = {
1961 ["Size of playdate_sprite"][::core::mem::size_of::<playdate_sprite>() - 504usize];
1962 ["Alignment of playdate_sprite"][::core::mem::align_of::<playdate_sprite>() - 8usize];
1963 ["Offset of field: playdate_sprite::setAlwaysRedraw"]
1964 [::core::mem::offset_of!(playdate_sprite, setAlwaysRedraw) - 0usize];
1965 ["Offset of field: playdate_sprite::addDirtyRect"]
1966 [::core::mem::offset_of!(playdate_sprite, addDirtyRect) - 8usize];
1967 ["Offset of field: playdate_sprite::drawSprites"]
1968 [::core::mem::offset_of!(playdate_sprite, drawSprites) - 16usize];
1969 ["Offset of field: playdate_sprite::updateAndDrawSprites"]
1970 [::core::mem::offset_of!(playdate_sprite, updateAndDrawSprites) - 24usize];
1971 ["Offset of field: playdate_sprite::newSprite"][::core::mem::offset_of!(playdate_sprite, newSprite) - 32usize];
1972 ["Offset of field: playdate_sprite::freeSprite"]
1973 [::core::mem::offset_of!(playdate_sprite, freeSprite) - 40usize];
1974 ["Offset of field: playdate_sprite::copy"][::core::mem::offset_of!(playdate_sprite, copy) - 48usize];
1975 ["Offset of field: playdate_sprite::addSprite"][::core::mem::offset_of!(playdate_sprite, addSprite) - 56usize];
1976 ["Offset of field: playdate_sprite::removeSprite"]
1977 [::core::mem::offset_of!(playdate_sprite, removeSprite) - 64usize];
1978 ["Offset of field: playdate_sprite::removeSprites"]
1979 [::core::mem::offset_of!(playdate_sprite, removeSprites) - 72usize];
1980 ["Offset of field: playdate_sprite::removeAllSprites"]
1981 [::core::mem::offset_of!(playdate_sprite, removeAllSprites) - 80usize];
1982 ["Offset of field: playdate_sprite::getSpriteCount"]
1983 [::core::mem::offset_of!(playdate_sprite, getSpriteCount) - 88usize];
1984 ["Offset of field: playdate_sprite::setBounds"][::core::mem::offset_of!(playdate_sprite, setBounds) - 96usize];
1985 ["Offset of field: playdate_sprite::getBounds"]
1986 [::core::mem::offset_of!(playdate_sprite, getBounds) - 104usize];
1987 ["Offset of field: playdate_sprite::moveTo"][::core::mem::offset_of!(playdate_sprite, moveTo) - 112usize];
1988 ["Offset of field: playdate_sprite::moveBy"][::core::mem::offset_of!(playdate_sprite, moveBy) - 120usize];
1989 ["Offset of field: playdate_sprite::setImage"][::core::mem::offset_of!(playdate_sprite, setImage) - 128usize];
1990 ["Offset of field: playdate_sprite::getImage"][::core::mem::offset_of!(playdate_sprite, getImage) - 136usize];
1991 ["Offset of field: playdate_sprite::setSize"][::core::mem::offset_of!(playdate_sprite, setSize) - 144usize];
1992 ["Offset of field: playdate_sprite::setZIndex"]
1993 [::core::mem::offset_of!(playdate_sprite, setZIndex) - 152usize];
1994 ["Offset of field: playdate_sprite::getZIndex"]
1995 [::core::mem::offset_of!(playdate_sprite, getZIndex) - 160usize];
1996 ["Offset of field: playdate_sprite::setDrawMode"]
1997 [::core::mem::offset_of!(playdate_sprite, setDrawMode) - 168usize];
1998 ["Offset of field: playdate_sprite::setImageFlip"]
1999 [::core::mem::offset_of!(playdate_sprite, setImageFlip) - 176usize];
2000 ["Offset of field: playdate_sprite::getImageFlip"]
2001 [::core::mem::offset_of!(playdate_sprite, getImageFlip) - 184usize];
2002 ["Offset of field: playdate_sprite::setStencil"]
2003 [::core::mem::offset_of!(playdate_sprite, setStencil) - 192usize];
2004 ["Offset of field: playdate_sprite::setClipRect"]
2005 [::core::mem::offset_of!(playdate_sprite, setClipRect) - 200usize];
2006 ["Offset of field: playdate_sprite::clearClipRect"]
2007 [::core::mem::offset_of!(playdate_sprite, clearClipRect) - 208usize];
2008 ["Offset of field: playdate_sprite::setClipRectsInRange"]
2009 [::core::mem::offset_of!(playdate_sprite, setClipRectsInRange) - 216usize];
2010 ["Offset of field: playdate_sprite::clearClipRectsInRange"]
2011 [::core::mem::offset_of!(playdate_sprite, clearClipRectsInRange) - 224usize];
2012 ["Offset of field: playdate_sprite::setUpdatesEnabled"]
2013 [::core::mem::offset_of!(playdate_sprite, setUpdatesEnabled) - 232usize];
2014 ["Offset of field: playdate_sprite::updatesEnabled"]
2015 [::core::mem::offset_of!(playdate_sprite, updatesEnabled) - 240usize];
2016 ["Offset of field: playdate_sprite::setCollisionsEnabled"]
2017 [::core::mem::offset_of!(playdate_sprite, setCollisionsEnabled) - 248usize];
2018 ["Offset of field: playdate_sprite::collisionsEnabled"]
2019 [::core::mem::offset_of!(playdate_sprite, collisionsEnabled) - 256usize];
2020 ["Offset of field: playdate_sprite::setVisible"]
2021 [::core::mem::offset_of!(playdate_sprite, setVisible) - 264usize];
2022 ["Offset of field: playdate_sprite::isVisible"]
2023 [::core::mem::offset_of!(playdate_sprite, isVisible) - 272usize];
2024 ["Offset of field: playdate_sprite::setOpaque"]
2025 [::core::mem::offset_of!(playdate_sprite, setOpaque) - 280usize];
2026 ["Offset of field: playdate_sprite::markDirty"]
2027 [::core::mem::offset_of!(playdate_sprite, markDirty) - 288usize];
2028 ["Offset of field: playdate_sprite::setTag"][::core::mem::offset_of!(playdate_sprite, setTag) - 296usize];
2029 ["Offset of field: playdate_sprite::getTag"][::core::mem::offset_of!(playdate_sprite, getTag) - 304usize];
2030 ["Offset of field: playdate_sprite::setIgnoresDrawOffset"]
2031 [::core::mem::offset_of!(playdate_sprite, setIgnoresDrawOffset) - 312usize];
2032 ["Offset of field: playdate_sprite::setUpdateFunction"]
2033 [::core::mem::offset_of!(playdate_sprite, setUpdateFunction) - 320usize];
2034 ["Offset of field: playdate_sprite::setDrawFunction"]
2035 [::core::mem::offset_of!(playdate_sprite, setDrawFunction) - 328usize];
2036 ["Offset of field: playdate_sprite::getPosition"]
2037 [::core::mem::offset_of!(playdate_sprite, getPosition) - 336usize];
2038 ["Offset of field: playdate_sprite::resetCollisionWorld"]
2039 [::core::mem::offset_of!(playdate_sprite, resetCollisionWorld) - 344usize];
2040 ["Offset of field: playdate_sprite::setCollideRect"]
2041 [::core::mem::offset_of!(playdate_sprite, setCollideRect) - 352usize];
2042 ["Offset of field: playdate_sprite::getCollideRect"]
2043 [::core::mem::offset_of!(playdate_sprite, getCollideRect) - 360usize];
2044 ["Offset of field: playdate_sprite::clearCollideRect"]
2045 [::core::mem::offset_of!(playdate_sprite, clearCollideRect) - 368usize];
2046 ["Offset of field: playdate_sprite::setCollisionResponseFunction"]
2047 [::core::mem::offset_of!(playdate_sprite, setCollisionResponseFunction) - 376usize];
2048 ["Offset of field: playdate_sprite::checkCollisions"]
2049 [::core::mem::offset_of!(playdate_sprite, checkCollisions) - 384usize];
2050 ["Offset of field: playdate_sprite::moveWithCollisions"]
2051 [::core::mem::offset_of!(playdate_sprite, moveWithCollisions) - 392usize];
2052 ["Offset of field: playdate_sprite::querySpritesAtPoint"]
2053 [::core::mem::offset_of!(playdate_sprite, querySpritesAtPoint) - 400usize];
2054 ["Offset of field: playdate_sprite::querySpritesInRect"]
2055 [::core::mem::offset_of!(playdate_sprite, querySpritesInRect) - 408usize];
2056 ["Offset of field: playdate_sprite::querySpritesAlongLine"]
2057 [::core::mem::offset_of!(playdate_sprite, querySpritesAlongLine) - 416usize];
2058 ["Offset of field: playdate_sprite::querySpriteInfoAlongLine"]
2059 [::core::mem::offset_of!(playdate_sprite, querySpriteInfoAlongLine) - 424usize];
2060 ["Offset of field: playdate_sprite::overlappingSprites"]
2061 [::core::mem::offset_of!(playdate_sprite, overlappingSprites) - 432usize];
2062 ["Offset of field: playdate_sprite::allOverlappingSprites"]
2063 [::core::mem::offset_of!(playdate_sprite, allOverlappingSprites) - 440usize];
2064 ["Offset of field: playdate_sprite::setStencilPattern"]
2065 [::core::mem::offset_of!(playdate_sprite, setStencilPattern) - 448usize];
2066 ["Offset of field: playdate_sprite::clearStencil"]
2067 [::core::mem::offset_of!(playdate_sprite, clearStencil) - 456usize];
2068 ["Offset of field: playdate_sprite::setUserdata"]
2069 [::core::mem::offset_of!(playdate_sprite, setUserdata) - 464usize];
2070 ["Offset of field: playdate_sprite::getUserdata"]
2071 [::core::mem::offset_of!(playdate_sprite, getUserdata) - 472usize];
2072 ["Offset of field: playdate_sprite::setStencilImage"]
2073 [::core::mem::offset_of!(playdate_sprite, setStencilImage) - 480usize];
2074 ["Offset of field: playdate_sprite::setCenter"]
2075 [::core::mem::offset_of!(playdate_sprite, setCenter) - 488usize];
2076 ["Offset of field: playdate_sprite::getCenter"]
2077 [::core::mem::offset_of!(playdate_sprite, getCenter) - 496usize];
2078};
2079#[repr(u32)]
2080#[must_use]
2081#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2082pub enum SoundFormat {
2083 kSound8bitMono = 0,
2084 kSound8bitStereo = 1,
2085 kSound16bitMono = 2,
2086 kSound16bitStereo = 3,
2087 kSoundADPCMMono = 4,
2088 kSoundADPCMStereo = 5,
2089}
2090pub type MIDINote = core::ffi::c_float;
2091#[repr(C)]
2092#[derive(Debug, Copy, Clone)]
2093#[must_use]
2094pub struct SoundSource {
2095 _unused: [u8; 0],
2096}
2097pub type sndCallbackProc =
2098 ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource, userdata: *mut core::ffi::c_void)>;
2099#[repr(C)]
2100#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2101#[must_use]
2102pub struct playdate_sound_source {
2103 #[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."]
2104 pub setVolume: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2105 lvol: core::ffi::c_float,
2106 rvol: core::ffi::c_float)>,
2107 #[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."]
2108 pub getVolume: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2109 outl: *mut core::ffi::c_float,
2110 outr: *mut core::ffi::c_float)>,
2111 #[doc = "`int playdate->sound->source->isPlaying(SoundSource* c)`\n\nReturns 1 if the source is currently playing."]
2112 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource) -> core::ffi::c_int>,
2113 pub setFinishCallback: ::core::option::Option<unsafe extern "C" fn(c: *mut SoundSource,
2114 callback: sndCallbackProc,
2115 userdata: *mut core::ffi::c_void)>,
2116}
2117#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2118const _: () = {
2119 ["Size of playdate_sound_source"][::core::mem::size_of::<playdate_sound_source>() - 32usize];
2120 ["Alignment of playdate_sound_source"][::core::mem::align_of::<playdate_sound_source>() - 8usize];
2121 ["Offset of field: playdate_sound_source::setVolume"]
2122 [::core::mem::offset_of!(playdate_sound_source, setVolume) - 0usize];
2123 ["Offset of field: playdate_sound_source::getVolume"]
2124 [::core::mem::offset_of!(playdate_sound_source, getVolume) - 8usize];
2125 ["Offset of field: playdate_sound_source::isPlaying"]
2126 [::core::mem::offset_of!(playdate_sound_source, isPlaying) - 16usize];
2127 ["Offset of field: playdate_sound_source::setFinishCallback"]
2128 [::core::mem::offset_of!(playdate_sound_source, setFinishCallback) - 24usize];
2129};
2130#[repr(C)]
2131#[derive(Debug, Copy, Clone)]
2132#[must_use]
2133pub struct FilePlayer {
2134 _unused: [u8; 0],
2135}
2136#[repr(C)]
2137#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2138#[must_use]
2139pub 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) > , }
2140#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2141const _: () = {
2142 ["Size of playdate_sound_fileplayer"][::core::mem::size_of::<playdate_sound_fileplayer>() - 176usize];
2143 ["Alignment of playdate_sound_fileplayer"][::core::mem::align_of::<playdate_sound_fileplayer>() - 8usize];
2144 ["Offset of field: playdate_sound_fileplayer::newPlayer"]
2145 [::core::mem::offset_of!(playdate_sound_fileplayer, newPlayer) - 0usize];
2146 ["Offset of field: playdate_sound_fileplayer::freePlayer"]
2147 [::core::mem::offset_of!(playdate_sound_fileplayer, freePlayer) - 8usize];
2148 ["Offset of field: playdate_sound_fileplayer::loadIntoPlayer"]
2149 [::core::mem::offset_of!(playdate_sound_fileplayer, loadIntoPlayer) - 16usize];
2150 ["Offset of field: playdate_sound_fileplayer::setBufferLength"]
2151 [::core::mem::offset_of!(playdate_sound_fileplayer, setBufferLength) - 24usize];
2152 ["Offset of field: playdate_sound_fileplayer::play"]
2153 [::core::mem::offset_of!(playdate_sound_fileplayer, play) - 32usize];
2154 ["Offset of field: playdate_sound_fileplayer::isPlaying"]
2155 [::core::mem::offset_of!(playdate_sound_fileplayer, isPlaying) - 40usize];
2156 ["Offset of field: playdate_sound_fileplayer::pause"]
2157 [::core::mem::offset_of!(playdate_sound_fileplayer, pause) - 48usize];
2158 ["Offset of field: playdate_sound_fileplayer::stop"]
2159 [::core::mem::offset_of!(playdate_sound_fileplayer, stop) - 56usize];
2160 ["Offset of field: playdate_sound_fileplayer::setVolume"]
2161 [::core::mem::offset_of!(playdate_sound_fileplayer, setVolume) - 64usize];
2162 ["Offset of field: playdate_sound_fileplayer::getVolume"]
2163 [::core::mem::offset_of!(playdate_sound_fileplayer, getVolume) - 72usize];
2164 ["Offset of field: playdate_sound_fileplayer::getLength"]
2165 [::core::mem::offset_of!(playdate_sound_fileplayer, getLength) - 80usize];
2166 ["Offset of field: playdate_sound_fileplayer::setOffset"]
2167 [::core::mem::offset_of!(playdate_sound_fileplayer, setOffset) - 88usize];
2168 ["Offset of field: playdate_sound_fileplayer::setRate"]
2169 [::core::mem::offset_of!(playdate_sound_fileplayer, setRate) - 96usize];
2170 ["Offset of field: playdate_sound_fileplayer::setLoopRange"]
2171 [::core::mem::offset_of!(playdate_sound_fileplayer, setLoopRange) - 104usize];
2172 ["Offset of field: playdate_sound_fileplayer::didUnderrun"]
2173 [::core::mem::offset_of!(playdate_sound_fileplayer, didUnderrun) - 112usize];
2174 ["Offset of field: playdate_sound_fileplayer::setFinishCallback"]
2175 [::core::mem::offset_of!(playdate_sound_fileplayer, setFinishCallback) - 120usize];
2176 ["Offset of field: playdate_sound_fileplayer::setLoopCallback"]
2177 [::core::mem::offset_of!(playdate_sound_fileplayer, setLoopCallback) - 128usize];
2178 ["Offset of field: playdate_sound_fileplayer::getOffset"]
2179 [::core::mem::offset_of!(playdate_sound_fileplayer, getOffset) - 136usize];
2180 ["Offset of field: playdate_sound_fileplayer::getRate"]
2181 [::core::mem::offset_of!(playdate_sound_fileplayer, getRate) - 144usize];
2182 ["Offset of field: playdate_sound_fileplayer::setStopOnUnderrun"]
2183 [::core::mem::offset_of!(playdate_sound_fileplayer, setStopOnUnderrun) - 152usize];
2184 ["Offset of field: playdate_sound_fileplayer::fadeVolume"]
2185 [::core::mem::offset_of!(playdate_sound_fileplayer, fadeVolume) - 160usize];
2186 ["Offset of field: playdate_sound_fileplayer::setMP3StreamSource"]
2187 [::core::mem::offset_of!(playdate_sound_fileplayer, setMP3StreamSource) - 168usize];
2188};
2189#[repr(C)]
2190#[derive(Debug, Copy, Clone)]
2191#[must_use]
2192pub struct AudioSample {
2193 _unused: [u8; 0],
2194}
2195#[repr(C)]
2196#[derive(Debug, Copy, Clone)]
2197#[must_use]
2198pub struct SamplePlayer {
2199 _unused: [u8; 0],
2200}
2201#[repr(C)]
2202#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2203#[must_use]
2204pub struct playdate_sound_sample {
2205 #[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."]
2206 pub newSampleBuffer:
2207 ::core::option::Option<unsafe extern "C" fn(byteCount: core::ffi::c_int) -> *mut AudioSample>,
2208 #[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*."]
2209 pub loadIntoSample: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample,
2210 path: *const core::ffi::c_char)
2211 -> core::ffi::c_int>,
2212 #[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."]
2213 pub load: ::core::option::Option<unsafe extern "C" fn(path: *const core::ffi::c_char) -> *mut AudioSample>,
2214 #[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```"]
2215 pub newSampleFromData: ::core::option::Option<unsafe extern "C" fn(data: *mut u8,
2216 format: SoundFormat,
2217 sampleRate: u32,
2218 byteCount: core::ffi::c_int,
2219 shouldFreeData: core::ffi::c_int)
2220 -> *mut AudioSample>,
2221 pub getData: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample,
2222 data: *mut *mut u8,
2223 format: *mut SoundFormat,
2224 sampleRate: *mut u32,
2225 bytelength: *mut u32)>,
2226 #[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."]
2227 pub freeSample: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample)>,
2228 #[doc = "`float playdate->sound->sample->getLength(AudioSample* sample)`\n\nReturns the length, in seconds, of *sample*."]
2229 pub getLength: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample) -> core::ffi::c_float>,
2230 #[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."]
2231 pub decompress: ::core::option::Option<unsafe extern "C" fn(sample: *mut AudioSample) -> core::ffi::c_int>,
2232}
2233#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2234const _: () = {
2235 ["Size of playdate_sound_sample"][::core::mem::size_of::<playdate_sound_sample>() - 64usize];
2236 ["Alignment of playdate_sound_sample"][::core::mem::align_of::<playdate_sound_sample>() - 8usize];
2237 ["Offset of field: playdate_sound_sample::newSampleBuffer"]
2238 [::core::mem::offset_of!(playdate_sound_sample, newSampleBuffer) - 0usize];
2239 ["Offset of field: playdate_sound_sample::loadIntoSample"]
2240 [::core::mem::offset_of!(playdate_sound_sample, loadIntoSample) - 8usize];
2241 ["Offset of field: playdate_sound_sample::load"]
2242 [::core::mem::offset_of!(playdate_sound_sample, load) - 16usize];
2243 ["Offset of field: playdate_sound_sample::newSampleFromData"]
2244 [::core::mem::offset_of!(playdate_sound_sample, newSampleFromData) - 24usize];
2245 ["Offset of field: playdate_sound_sample::getData"]
2246 [::core::mem::offset_of!(playdate_sound_sample, getData) - 32usize];
2247 ["Offset of field: playdate_sound_sample::freeSample"]
2248 [::core::mem::offset_of!(playdate_sound_sample, freeSample) - 40usize];
2249 ["Offset of field: playdate_sound_sample::getLength"]
2250 [::core::mem::offset_of!(playdate_sound_sample, getLength) - 48usize];
2251 ["Offset of field: playdate_sound_sample::decompress"]
2252 [::core::mem::offset_of!(playdate_sound_sample, decompress) - 56usize];
2253};
2254#[repr(C)]
2255#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2256#[must_use]
2257pub struct playdate_sound_sampleplayer {
2258 #[doc = "`SamplePlayer* playdate->sound->sampleplayer->newPlayer(void)`\n\nAllocates and returns a new SamplePlayer."]
2259 pub newPlayer: ::core::option::Option<unsafe extern "C" fn() -> *mut SamplePlayer>,
2260 #[doc = "`void playdate->sound->sampleplayer->freePlayer(SamplePlayer* player)`\n\nFrees the given *player*."]
2261 pub freePlayer: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer)>,
2262 #[doc = "`void playdate->sound->sampleplayer->setSample(SamplePlayer* player, AudioSample* sample)`\n\nAssigns *sample* to *player*."]
2263 pub setSample:
2264 ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, sample: *mut AudioSample)>,
2265 #[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)."]
2266 pub play: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2267 repeat: core::ffi::c_int,
2268 rate: core::ffi::c_float)
2269 -> core::ffi::c_int>,
2270 #[doc = "`int playdate->sound->sampleplayer->isPlaying(SamplePlayer* player)`\n\nReturns one if *player* is playing a sample, zero if not."]
2271 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_int>,
2272 #[doc = "`void playdate->sound->sampleplayer->stop(SamplePlayer* player)`\n\nStops playing the sample."]
2273 pub stop: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer)>,
2274 #[doc = "`void playdate->sound->sampleplayer->setVolume(SamplePlayer* player, float left, float right)`\n\nSets the playback volume for left and right channels."]
2275 pub setVolume: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2276 left: core::ffi::c_float,
2277 right: core::ffi::c_float)>,
2278 #[doc = "`void playdate->sound->sampleplayer->getVolume(SamplePlayer* player, float* outleft, float* outright)`\n\nGets the current left and right channel volume of the sampleplayer."]
2279 pub getVolume: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2280 left: *mut core::ffi::c_float,
2281 right: *mut core::ffi::c_float)>,
2282 #[doc = "`float playdate->sound->sampleplayer->getLength(SamplePlayer* player)`\n\nReturns the length, in seconds, of the sample assigned to *player*."]
2283 pub getLength: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2284 #[doc = "`void playdate->sound->sampleplayer->setOffset(SamplePlayer* player, float offset)`\n\nSets the current *offset* of the SamplePlayer, in seconds."]
2285 pub setOffset:
2286 ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, offset: core::ffi::c_float)>,
2287 #[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."]
2288 pub setRate: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, rate: core::ffi::c_float)>,
2289 #[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."]
2290 pub setPlayRange: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2291 start: core::ffi::c_int,
2292 end: core::ffi::c_int)>,
2293 #[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)."]
2294 pub setFinishCallback: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2295 callback: sndCallbackProc,
2296 userdata: *mut core::ffi::c_void)>,
2297 pub setLoopCallback: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer,
2298 callback: sndCallbackProc,
2299 userdata: *mut core::ffi::c_void)>,
2300 #[doc = "`float playdate->sound->sampleplayer->getOffset(SamplePlayer* player);`\n\nReturns the current offset in seconds for *player*."]
2301 pub getOffset: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2302 #[doc = "`float playdate->sound->sampleplayer->getRate(SamplePlayer* player)`\n\nReturns the playback rate for *player*."]
2303 pub getRate: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer) -> core::ffi::c_float>,
2304 #[doc = "`void playdate->sound->sampleplayer->setPaused(SamplePlayer* player, int paused)`\n\nPauses or resumes playback."]
2305 pub setPaused: ::core::option::Option<unsafe extern "C" fn(player: *mut SamplePlayer, flag: core::ffi::c_int)>,
2306}
2307#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2308const _: () = {
2309 ["Size of playdate_sound_sampleplayer"][::core::mem::size_of::<playdate_sound_sampleplayer>() - 136usize];
2310 ["Alignment of playdate_sound_sampleplayer"][::core::mem::align_of::<playdate_sound_sampleplayer>() - 8usize];
2311 ["Offset of field: playdate_sound_sampleplayer::newPlayer"]
2312 [::core::mem::offset_of!(playdate_sound_sampleplayer, newPlayer) - 0usize];
2313 ["Offset of field: playdate_sound_sampleplayer::freePlayer"]
2314 [::core::mem::offset_of!(playdate_sound_sampleplayer, freePlayer) - 8usize];
2315 ["Offset of field: playdate_sound_sampleplayer::setSample"]
2316 [::core::mem::offset_of!(playdate_sound_sampleplayer, setSample) - 16usize];
2317 ["Offset of field: playdate_sound_sampleplayer::play"]
2318 [::core::mem::offset_of!(playdate_sound_sampleplayer, play) - 24usize];
2319 ["Offset of field: playdate_sound_sampleplayer::isPlaying"]
2320 [::core::mem::offset_of!(playdate_sound_sampleplayer, isPlaying) - 32usize];
2321 ["Offset of field: playdate_sound_sampleplayer::stop"]
2322 [::core::mem::offset_of!(playdate_sound_sampleplayer, stop) - 40usize];
2323 ["Offset of field: playdate_sound_sampleplayer::setVolume"]
2324 [::core::mem::offset_of!(playdate_sound_sampleplayer, setVolume) - 48usize];
2325 ["Offset of field: playdate_sound_sampleplayer::getVolume"]
2326 [::core::mem::offset_of!(playdate_sound_sampleplayer, getVolume) - 56usize];
2327 ["Offset of field: playdate_sound_sampleplayer::getLength"]
2328 [::core::mem::offset_of!(playdate_sound_sampleplayer, getLength) - 64usize];
2329 ["Offset of field: playdate_sound_sampleplayer::setOffset"]
2330 [::core::mem::offset_of!(playdate_sound_sampleplayer, setOffset) - 72usize];
2331 ["Offset of field: playdate_sound_sampleplayer::setRate"]
2332 [::core::mem::offset_of!(playdate_sound_sampleplayer, setRate) - 80usize];
2333 ["Offset of field: playdate_sound_sampleplayer::setPlayRange"]
2334 [::core::mem::offset_of!(playdate_sound_sampleplayer, setPlayRange) - 88usize];
2335 ["Offset of field: playdate_sound_sampleplayer::setFinishCallback"]
2336 [::core::mem::offset_of!(playdate_sound_sampleplayer, setFinishCallback) - 96usize];
2337 ["Offset of field: playdate_sound_sampleplayer::setLoopCallback"]
2338 [::core::mem::offset_of!(playdate_sound_sampleplayer, setLoopCallback) - 104usize];
2339 ["Offset of field: playdate_sound_sampleplayer::getOffset"]
2340 [::core::mem::offset_of!(playdate_sound_sampleplayer, getOffset) - 112usize];
2341 ["Offset of field: playdate_sound_sampleplayer::getRate"]
2342 [::core::mem::offset_of!(playdate_sound_sampleplayer, getRate) - 120usize];
2343 ["Offset of field: playdate_sound_sampleplayer::setPaused"]
2344 [::core::mem::offset_of!(playdate_sound_sampleplayer, setPaused) - 128usize];
2345};
2346#[repr(C)]
2347#[derive(Debug, Copy, Clone)]
2348#[must_use]
2349pub struct PDSynthSignalValue {
2350 _unused: [u8; 0],
2351}
2352#[repr(C)]
2353#[derive(Debug, Copy, Clone)]
2354#[must_use]
2355pub struct PDSynthSignal {
2356 _unused: [u8; 0],
2357}
2358pub type signalStepFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2359 ioframes: *mut core::ffi::c_int,
2360 ifval: *mut core::ffi::c_float)
2361 -> core::ffi::c_float>;
2362pub type signalNoteOnFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2363 note: MIDINote,
2364 vel: core::ffi::c_float,
2365 len: core::ffi::c_float)>;
2366pub type signalNoteOffFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2367 stopped: core::ffi::c_int,
2368 offset: core::ffi::c_int)>;
2369pub type signalDeallocFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void)>;
2370#[repr(C)]
2371#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2372#[must_use]
2373pub struct playdate_sound_signal {
2374 #[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."]
2375 pub newSignal: ::core::option::Option<unsafe extern "C" fn(step: signalStepFunc,
2376 noteOn: signalNoteOnFunc,
2377 noteOff: signalNoteOffFunc,
2378 dealloc: signalDeallocFunc,
2379 userdata: *mut core::ffi::c_void)
2380 -> *mut PDSynthSignal>,
2381 #[doc = "`void playdate->sound->signal->freeSignal(PDSynthSignal* signal);`\n\nFrees a signal created with *playdate→sound→signal→newSignal()*."]
2382 pub freeSignal: ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal)>,
2383 #[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."]
2384 pub getValue: ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal) -> core::ffi::c_float>,
2385 #[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."]
2386 pub setValueScale:
2387 ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal, scale: core::ffi::c_float)>,
2388 #[doc = "`void playdate->sound->signal->setValueOffset(PDSynthSignal* signal, float offset);`\n\nOffsets the signal’s output by the given amount."]
2389 pub setValueOffset:
2390 ::core::option::Option<unsafe extern "C" fn(signal: *mut PDSynthSignal, offset: core::ffi::c_float)>,
2391 #[doc = "`PDSynthSignal* playdate->sound->signal->newSignalForValue(PDSynthSignalValue* value)`\n\nCreates a new PDSynthSignal that tracks a PDSynthSignalValue."]
2392 pub newSignalForValue:
2393 ::core::option::Option<unsafe extern "C" fn(value: *mut PDSynthSignalValue) -> *mut PDSynthSignal>,
2394}
2395#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2396const _: () = {
2397 ["Size of playdate_sound_signal"][::core::mem::size_of::<playdate_sound_signal>() - 48usize];
2398 ["Alignment of playdate_sound_signal"][::core::mem::align_of::<playdate_sound_signal>() - 8usize];
2399 ["Offset of field: playdate_sound_signal::newSignal"]
2400 [::core::mem::offset_of!(playdate_sound_signal, newSignal) - 0usize];
2401 ["Offset of field: playdate_sound_signal::freeSignal"]
2402 [::core::mem::offset_of!(playdate_sound_signal, freeSignal) - 8usize];
2403 ["Offset of field: playdate_sound_signal::getValue"]
2404 [::core::mem::offset_of!(playdate_sound_signal, getValue) - 16usize];
2405 ["Offset of field: playdate_sound_signal::setValueScale"]
2406 [::core::mem::offset_of!(playdate_sound_signal, setValueScale) - 24usize];
2407 ["Offset of field: playdate_sound_signal::setValueOffset"]
2408 [::core::mem::offset_of!(playdate_sound_signal, setValueOffset) - 32usize];
2409 ["Offset of field: playdate_sound_signal::newSignalForValue"]
2410 [::core::mem::offset_of!(playdate_sound_signal, newSignalForValue) - 40usize];
2411};
2412#[repr(u32)]
2413#[must_use]
2414#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2415pub enum LFOType {
2416 kLFOTypeSquare = 0,
2417 kLFOTypeTriangle = 1,
2418 kLFOTypeSine = 2,
2419 kLFOTypeSampleAndHold = 3,
2420 kLFOTypeSawtoothUp = 4,
2421 kLFOTypeSawtoothDown = 5,
2422 kLFOTypeArpeggiator = 6,
2423 kLFOTypeFunction = 7,
2424}
2425#[repr(C)]
2426#[derive(Debug, Copy, Clone)]
2427#[must_use]
2428pub struct PDSynthLFO {
2429 _unused: [u8; 0],
2430}
2431#[repr(C)]
2432#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2433#[must_use]
2434pub 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) > , }
2435#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2436const _: () = {
2437 ["Size of playdate_sound_lfo"][::core::mem::size_of::<playdate_sound_lfo>() - 112usize];
2438 ["Alignment of playdate_sound_lfo"][::core::mem::align_of::<playdate_sound_lfo>() - 8usize];
2439 ["Offset of field: playdate_sound_lfo::newLFO"][::core::mem::offset_of!(playdate_sound_lfo, newLFO) - 0usize];
2440 ["Offset of field: playdate_sound_lfo::freeLFO"]
2441 [::core::mem::offset_of!(playdate_sound_lfo, freeLFO) - 8usize];
2442 ["Offset of field: playdate_sound_lfo::setType"]
2443 [::core::mem::offset_of!(playdate_sound_lfo, setType) - 16usize];
2444 ["Offset of field: playdate_sound_lfo::setRate"]
2445 [::core::mem::offset_of!(playdate_sound_lfo, setRate) - 24usize];
2446 ["Offset of field: playdate_sound_lfo::setPhase"]
2447 [::core::mem::offset_of!(playdate_sound_lfo, setPhase) - 32usize];
2448 ["Offset of field: playdate_sound_lfo::setCenter"]
2449 [::core::mem::offset_of!(playdate_sound_lfo, setCenter) - 40usize];
2450 ["Offset of field: playdate_sound_lfo::setDepth"]
2451 [::core::mem::offset_of!(playdate_sound_lfo, setDepth) - 48usize];
2452 ["Offset of field: playdate_sound_lfo::setArpeggiation"]
2453 [::core::mem::offset_of!(playdate_sound_lfo, setArpeggiation) - 56usize];
2454 ["Offset of field: playdate_sound_lfo::setFunction"]
2455 [::core::mem::offset_of!(playdate_sound_lfo, setFunction) - 64usize];
2456 ["Offset of field: playdate_sound_lfo::setDelay"]
2457 [::core::mem::offset_of!(playdate_sound_lfo, setDelay) - 72usize];
2458 ["Offset of field: playdate_sound_lfo::setRetrigger"]
2459 [::core::mem::offset_of!(playdate_sound_lfo, setRetrigger) - 80usize];
2460 ["Offset of field: playdate_sound_lfo::getValue"]
2461 [::core::mem::offset_of!(playdate_sound_lfo, getValue) - 88usize];
2462 ["Offset of field: playdate_sound_lfo::setGlobal"]
2463 [::core::mem::offset_of!(playdate_sound_lfo, setGlobal) - 96usize];
2464 ["Offset of field: playdate_sound_lfo::setStartPhase"]
2465 [::core::mem::offset_of!(playdate_sound_lfo, setStartPhase) - 104usize];
2466};
2467#[repr(C)]
2468#[derive(Debug, Copy, Clone)]
2469#[must_use]
2470pub struct PDSynthEnvelope {
2471 _unused: [u8; 0],
2472}
2473#[repr(C)]
2474#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2475#[must_use]
2476pub struct playdate_sound_envelope {
2477 #[doc = "`PDSynthEnvelope* playdate->sound->envelope->newEnvelope(float attack, float decay, float sustain, float release)`\n\nCreates a new envelope with the given parameters."]
2478 pub newEnvelope: ::core::option::Option<unsafe extern "C" fn(attack: core::ffi::c_float,
2479 decay: core::ffi::c_float,
2480 sustain: core::ffi::c_float,
2481 release: core::ffi::c_float)
2482 -> *mut PDSynthEnvelope>,
2483 #[doc = "`void playdate->sound->envelope->freeEnvelope(PDSynthEnvelope* env)`\n\nFrees the envelope."]
2484 pub freeEnvelope: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope)>,
2485 #[doc = "`void playdate->sound->envelope->setAttack(PDSynthEnvelope* env, float attack)`"]
2486 pub setAttack:
2487 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, attack: core::ffi::c_float)>,
2488 #[doc = "`void playdate->sound->envelope->setDecay(PDSynthEnvelope* env, float decay)`"]
2489 pub setDecay:
2490 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, decay: core::ffi::c_float)>,
2491 #[doc = "`void playdate->sound->envelope->setSustain(PDSynthEnvelope* env, float sustain)`"]
2492 pub setSustain:
2493 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, sustain: core::ffi::c_float)>,
2494 #[doc = "`void playdate->sound->envelope->setRelease(PDSynthEnvelope* env, float release)`\n\nSets the ADSR parameters of the envelope."]
2495 pub setRelease:
2496 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, release: core::ffi::c_float)>,
2497 #[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."]
2498 pub setLegato: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, flag: core::ffi::c_int)>,
2499 #[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."]
2500 pub setRetrigger:
2501 ::core::option::Option<unsafe extern "C" fn(lfo: *mut PDSynthEnvelope, flag: core::ffi::c_int)>,
2502 #[doc = "`float playdate->sound->envelope->getValue(PDSynthEnvelope* env)`\n\nReturn the current output value of the envelope."]
2503 pub getValue: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope) -> core::ffi::c_float>,
2504 #[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)."]
2505 pub setCurvature:
2506 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, amount: core::ffi::c_float)>,
2507 #[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."]
2508 pub setVelocitySensitivity:
2509 ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope, velsens: core::ffi::c_float)>,
2510 #[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`."]
2511 pub setRateScaling: ::core::option::Option<unsafe extern "C" fn(env: *mut PDSynthEnvelope,
2512 scaling: core::ffi::c_float,
2513 start: MIDINote,
2514 end: MIDINote)>,
2515}
2516#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2517const _: () = {
2518 ["Size of playdate_sound_envelope"][::core::mem::size_of::<playdate_sound_envelope>() - 96usize];
2519 ["Alignment of playdate_sound_envelope"][::core::mem::align_of::<playdate_sound_envelope>() - 8usize];
2520 ["Offset of field: playdate_sound_envelope::newEnvelope"]
2521 [::core::mem::offset_of!(playdate_sound_envelope, newEnvelope) - 0usize];
2522 ["Offset of field: playdate_sound_envelope::freeEnvelope"]
2523 [::core::mem::offset_of!(playdate_sound_envelope, freeEnvelope) - 8usize];
2524 ["Offset of field: playdate_sound_envelope::setAttack"]
2525 [::core::mem::offset_of!(playdate_sound_envelope, setAttack) - 16usize];
2526 ["Offset of field: playdate_sound_envelope::setDecay"]
2527 [::core::mem::offset_of!(playdate_sound_envelope, setDecay) - 24usize];
2528 ["Offset of field: playdate_sound_envelope::setSustain"]
2529 [::core::mem::offset_of!(playdate_sound_envelope, setSustain) - 32usize];
2530 ["Offset of field: playdate_sound_envelope::setRelease"]
2531 [::core::mem::offset_of!(playdate_sound_envelope, setRelease) - 40usize];
2532 ["Offset of field: playdate_sound_envelope::setLegato"]
2533 [::core::mem::offset_of!(playdate_sound_envelope, setLegato) - 48usize];
2534 ["Offset of field: playdate_sound_envelope::setRetrigger"]
2535 [::core::mem::offset_of!(playdate_sound_envelope, setRetrigger) - 56usize];
2536 ["Offset of field: playdate_sound_envelope::getValue"]
2537 [::core::mem::offset_of!(playdate_sound_envelope, getValue) - 64usize];
2538 ["Offset of field: playdate_sound_envelope::setCurvature"]
2539 [::core::mem::offset_of!(playdate_sound_envelope, setCurvature) - 72usize];
2540 ["Offset of field: playdate_sound_envelope::setVelocitySensitivity"]
2541 [::core::mem::offset_of!(playdate_sound_envelope, setVelocitySensitivity) - 80usize];
2542 ["Offset of field: playdate_sound_envelope::setRateScaling"]
2543 [::core::mem::offset_of!(playdate_sound_envelope, setRateScaling) - 88usize];
2544};
2545#[repr(u32)]
2546#[must_use]
2547#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2548pub enum SoundWaveform {
2549 kWaveformSquare = 0,
2550 kWaveformTriangle = 1,
2551 kWaveformSine = 2,
2552 kWaveformNoise = 3,
2553 kWaveformSawtooth = 4,
2554 kWaveformPOPhase = 5,
2555 kWaveformPODigital = 6,
2556 kWaveformPOVosim = 7,
2557}
2558pub type synthRenderFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2559 left: *mut i32,
2560 right: *mut i32,
2561 nsamples: core::ffi::c_int,
2562 rate: u32,
2563 drate: i32)
2564 -> core::ffi::c_int>;
2565pub type synthNoteOnFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2566 note: MIDINote,
2567 velocity: core::ffi::c_float,
2568 len: core::ffi::c_float)>;
2569pub type synthReleaseFunc =
2570 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void, stop: core::ffi::c_int)>;
2571pub type synthSetParameterFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void,
2572 parameter: core::ffi::c_int,
2573 value: core::ffi::c_float)
2574 -> core::ffi::c_int>;
2575pub type synthDeallocFunc = ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void)>;
2576pub type synthCopyUserdata =
2577 ::core::option::Option<unsafe extern "C" fn(userdata: *mut core::ffi::c_void) -> *mut core::ffi::c_void>;
2578#[repr(C)]
2579#[derive(Debug, Copy, Clone)]
2580#[must_use]
2581pub struct PDSynth {
2582 _unused: [u8; 0],
2583}
2584#[repr(C)]
2585#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2586#[must_use]
2587pub struct playdate_sound_synth {
2588 #[doc = "`PDSynth* playdate->sound->synth->newSynth(void)`\n\nCreates a new synth object."]
2589 pub newSynth: ::core::option::Option<unsafe extern "C" fn() -> *mut PDSynth>,
2590 #[doc = "`void playdate->sound->synth->freeSynth(PDSynth* synth)`\n\nFrees a synth object, first removing it from the sound engine if needed."]
2591 pub freeSynth: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2592 #[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```"]
2593 pub setWaveform: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, wave: SoundWaveform)>,
2594 pub setGenerator_deprecated: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2595 stereo: core::ffi::c_int,
2596 render: synthRenderFunc,
2597 noteOn: synthNoteOnFunc,
2598 release: synthReleaseFunc,
2599 setparam: synthSetParameterFunc,
2600 dealloc: synthDeallocFunc,
2601 userdata: *mut core::ffi::c_void)>,
2602 #[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."]
2603 pub setSample: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2604 sample: *mut AudioSample,
2605 sustainStart: u32,
2606 sustainEnd: u32)>,
2607 #[doc = "`void playdate->sound->synth->setAttackTime(PDSynth* synth, float attack)`"]
2608 pub setAttackTime:
2609 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, attack: core::ffi::c_float)>,
2610 #[doc = "`void playdate->sound->synth->setDecayTime(PDSynth* synth, float decay)`"]
2611 pub setDecayTime: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, decay: core::ffi::c_float)>,
2612 #[doc = "`void playdate->sound->synth->setSustainLevel(PDSynth* synth, float sustain)`"]
2613 pub setSustainLevel:
2614 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, sustain: core::ffi::c_float)>,
2615 #[doc = "`void playdate->sound->synth->setReleaseTime(PDSynth* synth, float release)`\n\nSets the parameters of the synth’s ADSR envelope."]
2616 pub setReleaseTime:
2617 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, release: core::ffi::c_float)>,
2618 #[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."]
2619 pub setTranspose:
2620 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, halfSteps: core::ffi::c_float)>,
2621 #[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."]
2622 pub setFrequencyModulator:
2623 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, mod_: *mut PDSynthSignalValue)>,
2624 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getFrequencyModulator(PDSynth* synth)`\n\nReturns the currently set frequency modulator."]
2625 pub getFrequencyModulator:
2626 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthSignalValue>,
2627 #[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."]
2628 pub setAmplitudeModulator:
2629 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, mod_: *mut PDSynthSignalValue)>,
2630 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getAmplitudeModulator(PDSynth* synth)`\n\nReturns the currently set amplitude modulator."]
2631 pub getAmplitudeModulator:
2632 ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthSignalValue>,
2633 #[doc = "`int playdate->sound->synth->getParameterCount(PDSynth* synth)`\n\nReturns the number of parameters advertised by the synth."]
2634 pub getParameterCount: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> core::ffi::c_int>,
2635 #[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."]
2636 pub setParameter: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2637 parameter: core::ffi::c_int,
2638 value: core::ffi::c_float)
2639 -> core::ffi::c_int>,
2640 #[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."]
2641 pub setParameterModulator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2642 parameter: core::ffi::c_int,
2643 mod_: *mut PDSynthSignalValue)>,
2644 #[doc = "`PDSynthSignalValue* playdate->sound->synth->getParameterModulator(PDSynth* synth, int num)`\n\nReturns the currently set parameter modulator for the given index."]
2645 pub getParameterModulator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2646 parameter: core::ffi::c_int)
2647 -> *mut PDSynthSignalValue>,
2648 #[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."]
2649 pub playNote: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2650 freq: core::ffi::c_float,
2651 vel: core::ffi::c_float,
2652 len: core::ffi::c_float,
2653 when: u32)>,
2654 #[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)."]
2655 pub playMIDINote: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2656 note: MIDINote,
2657 vel: core::ffi::c_float,
2658 len: core::ffi::c_float,
2659 when: u32)>,
2660 #[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."]
2661 pub noteOff: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth, when: u32)>,
2662 pub stop: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2663 #[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```"]
2664 pub setVolume: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2665 left: core::ffi::c_float,
2666 right: core::ffi::c_float)>,
2667 #[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```"]
2668 pub getVolume: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2669 left: *mut core::ffi::c_float,
2670 right: *mut core::ffi::c_float)>,
2671 #[doc = "`int playdate->sound->synth->isPlaying(PDSynth* synth)`\n\nReturns 1 if the synth is currently playing."]
2672 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> core::ffi::c_int>,
2673 #[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."]
2674 pub getEnvelope: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynthEnvelope>,
2675 #[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"]
2676 pub setWavetable: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2677 sample: *mut AudioSample,
2678 log2size: core::ffi::c_int,
2679 columns: core::ffi::c_int,
2680 rows: core::ffi::c_int)
2681 -> core::ffi::c_int>,
2682 #[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."]
2683 pub setGenerator: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth,
2684 stereo: core::ffi::c_int,
2685 render: synthRenderFunc,
2686 noteOn: synthNoteOnFunc,
2687 release: synthReleaseFunc,
2688 setparam: synthSetParameterFunc,
2689 dealloc: synthDeallocFunc,
2690 copyUserdata: synthCopyUserdata,
2691 userdata: *mut core::ffi::c_void)>,
2692 #[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."]
2693 pub copy: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth) -> *mut PDSynth>,
2694 #[doc = "`void playdate->sound->synth->clearEnvelope(PDSynth* synth)`\n\nClears the synth’s envelope settings."]
2695 pub clearEnvelope: ::core::option::Option<unsafe extern "C" fn(synth: *mut PDSynth)>,
2696}
2697#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2698const _: () = {
2699 ["Size of playdate_sound_synth"][::core::mem::size_of::<playdate_sound_synth>() - 240usize];
2700 ["Alignment of playdate_sound_synth"][::core::mem::align_of::<playdate_sound_synth>() - 8usize];
2701 ["Offset of field: playdate_sound_synth::newSynth"]
2702 [::core::mem::offset_of!(playdate_sound_synth, newSynth) - 0usize];
2703 ["Offset of field: playdate_sound_synth::freeSynth"]
2704 [::core::mem::offset_of!(playdate_sound_synth, freeSynth) - 8usize];
2705 ["Offset of field: playdate_sound_synth::setWaveform"]
2706 [::core::mem::offset_of!(playdate_sound_synth, setWaveform) - 16usize];
2707 ["Offset of field: playdate_sound_synth::setGenerator_deprecated"]
2708 [::core::mem::offset_of!(playdate_sound_synth, setGenerator_deprecated) - 24usize];
2709 ["Offset of field: playdate_sound_synth::setSample"]
2710 [::core::mem::offset_of!(playdate_sound_synth, setSample) - 32usize];
2711 ["Offset of field: playdate_sound_synth::setAttackTime"]
2712 [::core::mem::offset_of!(playdate_sound_synth, setAttackTime) - 40usize];
2713 ["Offset of field: playdate_sound_synth::setDecayTime"]
2714 [::core::mem::offset_of!(playdate_sound_synth, setDecayTime) - 48usize];
2715 ["Offset of field: playdate_sound_synth::setSustainLevel"]
2716 [::core::mem::offset_of!(playdate_sound_synth, setSustainLevel) - 56usize];
2717 ["Offset of field: playdate_sound_synth::setReleaseTime"]
2718 [::core::mem::offset_of!(playdate_sound_synth, setReleaseTime) - 64usize];
2719 ["Offset of field: playdate_sound_synth::setTranspose"]
2720 [::core::mem::offset_of!(playdate_sound_synth, setTranspose) - 72usize];
2721 ["Offset of field: playdate_sound_synth::setFrequencyModulator"]
2722 [::core::mem::offset_of!(playdate_sound_synth, setFrequencyModulator) - 80usize];
2723 ["Offset of field: playdate_sound_synth::getFrequencyModulator"]
2724 [::core::mem::offset_of!(playdate_sound_synth, getFrequencyModulator) - 88usize];
2725 ["Offset of field: playdate_sound_synth::setAmplitudeModulator"]
2726 [::core::mem::offset_of!(playdate_sound_synth, setAmplitudeModulator) - 96usize];
2727 ["Offset of field: playdate_sound_synth::getAmplitudeModulator"]
2728 [::core::mem::offset_of!(playdate_sound_synth, getAmplitudeModulator) - 104usize];
2729 ["Offset of field: playdate_sound_synth::getParameterCount"]
2730 [::core::mem::offset_of!(playdate_sound_synth, getParameterCount) - 112usize];
2731 ["Offset of field: playdate_sound_synth::setParameter"]
2732 [::core::mem::offset_of!(playdate_sound_synth, setParameter) - 120usize];
2733 ["Offset of field: playdate_sound_synth::setParameterModulator"]
2734 [::core::mem::offset_of!(playdate_sound_synth, setParameterModulator) - 128usize];
2735 ["Offset of field: playdate_sound_synth::getParameterModulator"]
2736 [::core::mem::offset_of!(playdate_sound_synth, getParameterModulator) - 136usize];
2737 ["Offset of field: playdate_sound_synth::playNote"]
2738 [::core::mem::offset_of!(playdate_sound_synth, playNote) - 144usize];
2739 ["Offset of field: playdate_sound_synth::playMIDINote"]
2740 [::core::mem::offset_of!(playdate_sound_synth, playMIDINote) - 152usize];
2741 ["Offset of field: playdate_sound_synth::noteOff"]
2742 [::core::mem::offset_of!(playdate_sound_synth, noteOff) - 160usize];
2743 ["Offset of field: playdate_sound_synth::stop"]
2744 [::core::mem::offset_of!(playdate_sound_synth, stop) - 168usize];
2745 ["Offset of field: playdate_sound_synth::setVolume"]
2746 [::core::mem::offset_of!(playdate_sound_synth, setVolume) - 176usize];
2747 ["Offset of field: playdate_sound_synth::getVolume"]
2748 [::core::mem::offset_of!(playdate_sound_synth, getVolume) - 184usize];
2749 ["Offset of field: playdate_sound_synth::isPlaying"]
2750 [::core::mem::offset_of!(playdate_sound_synth, isPlaying) - 192usize];
2751 ["Offset of field: playdate_sound_synth::getEnvelope"]
2752 [::core::mem::offset_of!(playdate_sound_synth, getEnvelope) - 200usize];
2753 ["Offset of field: playdate_sound_synth::setWavetable"]
2754 [::core::mem::offset_of!(playdate_sound_synth, setWavetable) - 208usize];
2755 ["Offset of field: playdate_sound_synth::setGenerator"]
2756 [::core::mem::offset_of!(playdate_sound_synth, setGenerator) - 216usize];
2757 ["Offset of field: playdate_sound_synth::copy"]
2758 [::core::mem::offset_of!(playdate_sound_synth, copy) - 224usize];
2759 ["Offset of field: playdate_sound_synth::clearEnvelope"]
2760 [::core::mem::offset_of!(playdate_sound_synth, clearEnvelope) - 232usize];
2761};
2762#[repr(C)]
2763#[derive(Debug, Copy, Clone)]
2764#[must_use]
2765pub struct ControlSignal {
2766 _unused: [u8; 0],
2767}
2768#[repr(C)]
2769#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2770#[must_use]
2771pub struct playdate_control_signal {
2772 #[doc = "`ControlSignal* playdate->sound->controlsignal->newSignal(void)`\n\nCreates a new control signal object."]
2773 pub newSignal: ::core::option::Option<unsafe extern "C" fn() -> *mut ControlSignal>,
2774 #[doc = "`void playdate->sound->controlsignal->freeSignal(ControlSignal* signal)`\n\nFrees the given signal."]
2775 pub freeSignal: ::core::option::Option<unsafe extern "C" fn(signal: *mut ControlSignal)>,
2776 #[doc = "`void playdate->sound->controlsignal->clearEvents(ControlSignal* signal)`\n\nClears all events from the given signal."]
2777 pub clearEvents: ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal)>,
2778 #[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."]
2779 pub addEvent: ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal,
2780 step: core::ffi::c_int,
2781 value: core::ffi::c_float,
2782 interpolate: core::ffi::c_int)>,
2783 #[doc = "`void playdate->sound->controlsignal->removeEvent(ControlSignal* signal, int step)`\n\nRemoves the control event at the given step."]
2784 pub removeEvent:
2785 ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal, step: core::ffi::c_int)>,
2786 #[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)."]
2787 pub getMIDIControllerNumber:
2788 ::core::option::Option<unsafe extern "C" fn(control: *mut ControlSignal) -> core::ffi::c_int>,
2789}
2790#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2791const _: () = {
2792 ["Size of playdate_control_signal"][::core::mem::size_of::<playdate_control_signal>() - 48usize];
2793 ["Alignment of playdate_control_signal"][::core::mem::align_of::<playdate_control_signal>() - 8usize];
2794 ["Offset of field: playdate_control_signal::newSignal"]
2795 [::core::mem::offset_of!(playdate_control_signal, newSignal) - 0usize];
2796 ["Offset of field: playdate_control_signal::freeSignal"]
2797 [::core::mem::offset_of!(playdate_control_signal, freeSignal) - 8usize];
2798 ["Offset of field: playdate_control_signal::clearEvents"]
2799 [::core::mem::offset_of!(playdate_control_signal, clearEvents) - 16usize];
2800 ["Offset of field: playdate_control_signal::addEvent"]
2801 [::core::mem::offset_of!(playdate_control_signal, addEvent) - 24usize];
2802 ["Offset of field: playdate_control_signal::removeEvent"]
2803 [::core::mem::offset_of!(playdate_control_signal, removeEvent) - 32usize];
2804 ["Offset of field: playdate_control_signal::getMIDIControllerNumber"]
2805 [::core::mem::offset_of!(playdate_control_signal, getMIDIControllerNumber) - 40usize];
2806};
2807#[repr(C)]
2808#[derive(Debug, Copy, Clone)]
2809#[must_use]
2810pub struct PDSynthInstrument {
2811 _unused: [u8; 0],
2812}
2813#[repr(C)]
2814#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2815#[must_use]
2816pub struct playdate_sound_instrument {
2817 #[doc = "`PDSynthInstrument* playdate->sound->instrument->newInstrument(void)`\n\nCreates a new PDSynthInstrument object."]
2818 pub newInstrument: ::core::option::Option<unsafe extern "C" fn() -> *mut PDSynthInstrument>,
2819 #[doc = "`void playdate->sound->instrument->freeInstrument(PDSynthInstrument* instrument)`\n\nFrees the given instrument, first removing it from the sound engine if needed."]
2820 pub freeInstrument: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument)>,
2821 #[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."]
2822 pub addVoice: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2823 synth: *mut PDSynth,
2824 rangeStart: MIDINote,
2825 rangeEnd: MIDINote,
2826 transpose: core::ffi::c_float)
2827 -> core::ffi::c_int>,
2828 #[doc = "`PDSynth* playdate->sound->instrument->playNote(PDSynthInstrument* instrument, float frequency, float vel, float len, uint32_t when)`"]
2829 pub playNote: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2830 frequency: core::ffi::c_float,
2831 vel: core::ffi::c_float,
2832 len: core::ffi::c_float,
2833 when: u32)
2834 -> *mut PDSynth>,
2835 #[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."]
2836 pub playMIDINote: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2837 note: MIDINote,
2838 vel: core::ffi::c_float,
2839 len: core::ffi::c_float,
2840 when: u32)
2841 -> *mut PDSynth>,
2842 #[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."]
2843 pub setPitchBend:
2844 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, bend: core::ffi::c_float)>,
2845 #[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."]
2846 pub setPitchBendRange:
2847 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, halfSteps: core::ffi::c_float)>,
2848 #[doc = "`void playdate->sound->instrument->setTranspose(PDSynthInstrument* instrument, float halfSteps)`\n\nSets the transpose parameter for all voices in the instrument."]
2849 pub setTranspose:
2850 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, halfSteps: core::ffi::c_float)>,
2851 #[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)."]
2852 pub noteOff:
2853 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, note: MIDINote, when: u32)>,
2854 #[doc = "`void playdate->sound->instrument->allNotesOff(PDSynthInstrument* instrument, uint32_t when)`\n\nSends a noteOff event to all voices in the instrument."]
2855 pub allNotesOff: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument, when: u32)>,
2856 #[doc = "`void playdate->sound->instrument->setVolume(PDSynthInstrument* instrument, float lvol, float rvol)`"]
2857 pub setVolume: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2858 left: core::ffi::c_float,
2859 right: core::ffi::c_float)>,
2860 #[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```"]
2861 pub getVolume: ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument,
2862 left: *mut core::ffi::c_float,
2863 right: *mut core::ffi::c_float)>,
2864 #[doc = "`int playdate->sound->instrument->activeVoiceCount(PDSynthInstrument* instrument)`\n\nReturns the number of voices in the instrument currently playing."]
2865 pub activeVoiceCount:
2866 ::core::option::Option<unsafe extern "C" fn(inst: *mut PDSynthInstrument) -> core::ffi::c_int>,
2867}
2868#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2869const _: () = {
2870 ["Size of playdate_sound_instrument"][::core::mem::size_of::<playdate_sound_instrument>() - 104usize];
2871 ["Alignment of playdate_sound_instrument"][::core::mem::align_of::<playdate_sound_instrument>() - 8usize];
2872 ["Offset of field: playdate_sound_instrument::newInstrument"]
2873 [::core::mem::offset_of!(playdate_sound_instrument, newInstrument) - 0usize];
2874 ["Offset of field: playdate_sound_instrument::freeInstrument"]
2875 [::core::mem::offset_of!(playdate_sound_instrument, freeInstrument) - 8usize];
2876 ["Offset of field: playdate_sound_instrument::addVoice"]
2877 [::core::mem::offset_of!(playdate_sound_instrument, addVoice) - 16usize];
2878 ["Offset of field: playdate_sound_instrument::playNote"]
2879 [::core::mem::offset_of!(playdate_sound_instrument, playNote) - 24usize];
2880 ["Offset of field: playdate_sound_instrument::playMIDINote"]
2881 [::core::mem::offset_of!(playdate_sound_instrument, playMIDINote) - 32usize];
2882 ["Offset of field: playdate_sound_instrument::setPitchBend"]
2883 [::core::mem::offset_of!(playdate_sound_instrument, setPitchBend) - 40usize];
2884 ["Offset of field: playdate_sound_instrument::setPitchBendRange"]
2885 [::core::mem::offset_of!(playdate_sound_instrument, setPitchBendRange) - 48usize];
2886 ["Offset of field: playdate_sound_instrument::setTranspose"]
2887 [::core::mem::offset_of!(playdate_sound_instrument, setTranspose) - 56usize];
2888 ["Offset of field: playdate_sound_instrument::noteOff"]
2889 [::core::mem::offset_of!(playdate_sound_instrument, noteOff) - 64usize];
2890 ["Offset of field: playdate_sound_instrument::allNotesOff"]
2891 [::core::mem::offset_of!(playdate_sound_instrument, allNotesOff) - 72usize];
2892 ["Offset of field: playdate_sound_instrument::setVolume"]
2893 [::core::mem::offset_of!(playdate_sound_instrument, setVolume) - 80usize];
2894 ["Offset of field: playdate_sound_instrument::getVolume"]
2895 [::core::mem::offset_of!(playdate_sound_instrument, getVolume) - 88usize];
2896 ["Offset of field: playdate_sound_instrument::activeVoiceCount"]
2897 [::core::mem::offset_of!(playdate_sound_instrument, activeVoiceCount) - 96usize];
2898};
2899#[repr(C)]
2900#[derive(Debug, Copy, Clone)]
2901#[must_use]
2902pub struct SequenceTrack {
2903 _unused: [u8; 0],
2904}
2905#[repr(C)]
2906#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
2907#[must_use]
2908pub struct playdate_sound_track {
2909 #[doc = "`SequenceTrack* playdate->sound->track->newTrack(void)`\n\nReturns a new SequenceTrack."]
2910 pub newTrack: ::core::option::Option<unsafe extern "C" fn() -> *mut SequenceTrack>,
2911 #[doc = "`void playdate->sound->track->freeTrack(SequenceTrack* track)`\n\nFrees the SequenceTrack."]
2912 pub freeTrack: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2913 #[doc = "`void playdate->sound->track->setInstrument(SequenceTrack* track, PDSynthInstrument* instrument)`"]
2914 pub setInstrument:
2915 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, inst: *mut PDSynthInstrument)>,
2916 #[doc = "`PDSynthInstrument* playdate->sound->track->getInstrument(SequenceTrack* track)`\n\nSets or gets the [PDSynthInstrument](#C-sound.PDSynthInstrument) assigned to the track."]
2917 pub getInstrument:
2918 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> *mut PDSynthInstrument>,
2919 #[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."]
2920 pub addNoteEvent: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2921 step: u32,
2922 len: u32,
2923 note: MIDINote,
2924 velocity: core::ffi::c_float)>,
2925 #[doc = "`void playdate->sound->track->removeNoteEvent(SequenceTrack* track, uint32_t step, MIDINote note)`\n\nRemoves the event at *step* playing *note*."]
2926 pub removeNoteEvent:
2927 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, step: u32, note: MIDINote)>,
2928 #[doc = "`void playdate->sound->track->clearNotes(SequenceTrack* track)`\n\nClears all notes from the track."]
2929 pub clearNotes: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2930 #[doc = "`void playdate->sound->track->getControlSignalCount(SequenceTrack* track)`\n\nReturns the number of [ControlSignal](#C-sound.ControlSignal) objects in the track."]
2931 pub getControlSignalCount:
2932 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2933 #[doc = "`void playdate->sound->track->getControlSignal(SequenceTrack* track, int idx)`\n\nReturns the [ControlSignal](#C-sound.ControlSignal) at index *idx*."]
2934 pub getControlSignal: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2935 idx: core::ffi::c_int)
2936 -> *mut ControlSignal>,
2937 #[doc = "`void playdate->sound->track->clearControlEvents(SequenceTrack* track)`\n\nClears all [ControlSignals](#C-sound.ControlSignal) from the track."]
2938 pub clearControlEvents: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack)>,
2939 #[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.)"]
2940 pub getPolyphony: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2941 #[doc = "`int playdate->sound->track->activeVoiceCount(SequenceTrack* track)`\n\nReturns the number of voices currently playing in the track’s instrument."]
2942 pub activeVoiceCount:
2943 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> core::ffi::c_int>,
2944 #[doc = "`void playdate->sound->track->setMuted(SequenceTrack* track, int mute)`\n\nMutes or unmutes the track."]
2945 pub setMuted: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, mute: core::ffi::c_int)>,
2946 #[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."]
2947 pub getLength: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack) -> u32>,
2948 #[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."]
2949 pub getIndexForStep:
2950 ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack, step: u32) -> core::ffi::c_int>,
2951 #[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."]
2952 pub getNoteAtIndex: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2953 index: core::ffi::c_int,
2954 outStep: *mut u32,
2955 outLen: *mut u32,
2956 outNote: *mut MIDINote,
2957 outVelocity: *mut core::ffi::c_float)
2958 -> core::ffi::c_int>,
2959 #[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."]
2960 pub getSignalForController: ::core::option::Option<unsafe extern "C" fn(track: *mut SequenceTrack,
2961 controller: core::ffi::c_int,
2962 create: core::ffi::c_int)
2963 -> *mut ControlSignal>,
2964}
2965#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2966const _: () = {
2967 ["Size of playdate_sound_track"][::core::mem::size_of::<playdate_sound_track>() - 136usize];
2968 ["Alignment of playdate_sound_track"][::core::mem::align_of::<playdate_sound_track>() - 8usize];
2969 ["Offset of field: playdate_sound_track::newTrack"]
2970 [::core::mem::offset_of!(playdate_sound_track, newTrack) - 0usize];
2971 ["Offset of field: playdate_sound_track::freeTrack"]
2972 [::core::mem::offset_of!(playdate_sound_track, freeTrack) - 8usize];
2973 ["Offset of field: playdate_sound_track::setInstrument"]
2974 [::core::mem::offset_of!(playdate_sound_track, setInstrument) - 16usize];
2975 ["Offset of field: playdate_sound_track::getInstrument"]
2976 [::core::mem::offset_of!(playdate_sound_track, getInstrument) - 24usize];
2977 ["Offset of field: playdate_sound_track::addNoteEvent"]
2978 [::core::mem::offset_of!(playdate_sound_track, addNoteEvent) - 32usize];
2979 ["Offset of field: playdate_sound_track::removeNoteEvent"]
2980 [::core::mem::offset_of!(playdate_sound_track, removeNoteEvent) - 40usize];
2981 ["Offset of field: playdate_sound_track::clearNotes"]
2982 [::core::mem::offset_of!(playdate_sound_track, clearNotes) - 48usize];
2983 ["Offset of field: playdate_sound_track::getControlSignalCount"]
2984 [::core::mem::offset_of!(playdate_sound_track, getControlSignalCount) - 56usize];
2985 ["Offset of field: playdate_sound_track::getControlSignal"]
2986 [::core::mem::offset_of!(playdate_sound_track, getControlSignal) - 64usize];
2987 ["Offset of field: playdate_sound_track::clearControlEvents"]
2988 [::core::mem::offset_of!(playdate_sound_track, clearControlEvents) - 72usize];
2989 ["Offset of field: playdate_sound_track::getPolyphony"]
2990 [::core::mem::offset_of!(playdate_sound_track, getPolyphony) - 80usize];
2991 ["Offset of field: playdate_sound_track::activeVoiceCount"]
2992 [::core::mem::offset_of!(playdate_sound_track, activeVoiceCount) - 88usize];
2993 ["Offset of field: playdate_sound_track::setMuted"]
2994 [::core::mem::offset_of!(playdate_sound_track, setMuted) - 96usize];
2995 ["Offset of field: playdate_sound_track::getLength"]
2996 [::core::mem::offset_of!(playdate_sound_track, getLength) - 104usize];
2997 ["Offset of field: playdate_sound_track::getIndexForStep"]
2998 [::core::mem::offset_of!(playdate_sound_track, getIndexForStep) - 112usize];
2999 ["Offset of field: playdate_sound_track::getNoteAtIndex"]
3000 [::core::mem::offset_of!(playdate_sound_track, getNoteAtIndex) - 120usize];
3001 ["Offset of field: playdate_sound_track::getSignalForController"]
3002 [::core::mem::offset_of!(playdate_sound_track, getSignalForController) - 128usize];
3003};
3004#[repr(C)]
3005#[derive(Debug, Copy, Clone)]
3006#[must_use]
3007pub struct SoundSequence {
3008 _unused: [u8; 0],
3009}
3010pub type SequenceFinishedCallback =
3011 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, userdata: *mut core::ffi::c_void)>;
3012#[repr(C)]
3013#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3014#[must_use]
3015pub struct playdate_sound_sequence {
3016 #[doc = "`SoundSequence* playdate->sound->sequence->newSequence(void)`"]
3017 pub newSequence: ::core::option::Option<unsafe extern "C" fn() -> *mut SoundSequence>,
3018 #[doc = "`void playdate->sound->sequence->freeSequence(SoundSequence* sequence)`\n\nCreates or destroys a SoundSequence object."]
3019 pub freeSequence: ::core::option::Option<unsafe extern "C" fn(sequence: *mut SoundSequence)>,
3020 #[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."]
3021 pub loadMIDIFile: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3022 path: *const core::ffi::c_char)
3023 -> core::ffi::c_int>,
3024 #[doc = "`uint32_t playdate->sound->sequence->getTime(SoundSequence* sequence)`"]
3025 pub getTime: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> u32>,
3026 #[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."]
3027 pub setTime: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, time: u32)>,
3028 #[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."]
3029 pub setLoops: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3030 loopstart: core::ffi::c_int,
3031 loopend: core::ffi::c_int,
3032 loops: core::ffi::c_int)>,
3033 pub getTempo_deprecated:
3034 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3035 #[doc = "`void playdate->sound->sequence->setTempo(SoundSequence* sequence, float stepsPerSecond)`\n\nSets or gets the tempo of the sequence, in steps per second."]
3036 pub setTempo:
3037 ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence, stepsPerSecond: core::ffi::c_float)>,
3038 #[doc = "`int playdate->sound->sequence->getTrackCount(SoundSequence* sequence)`\n\nReturns the number of tracks in the sequence."]
3039 pub getTrackCount: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3040 #[doc = "`SequenceTrack* playdate->sound->sequence->addTrack(SoundSequence* sequence)`\n\nAdds the given [playdate.sound.track](#C-sound.track) to the sequence."]
3041 pub addTrack: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> *mut SequenceTrack>,
3042 #[doc = "`SequenceTrack* playdate->sound->sequence->getTrackAtIndex(SoundSequence* sequence, unsigned int idx)`"]
3043 pub getTrackAtIndex: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3044 track: core::ffi::c_uint)
3045 -> *mut SequenceTrack>,
3046 #[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."]
3047 pub setTrackAtIndex: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3048 track: *mut SequenceTrack,
3049 idx: core::ffi::c_uint)>,
3050 #[doc = "`void playdate->sound->sequence->allNotesOff(SoundSequence* sequence)`\n\nSends a stop signal to all playing notes on all tracks."]
3051 pub allNotesOff: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence)>,
3052 #[doc = "`int playdate->sound->sequence->isPlaying(SoundSequence* sequence)`\n\nReturns 1 if the sequence is currently playing, otherwise 0."]
3053 pub isPlaying: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_int>,
3054 #[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)."]
3055 pub getLength: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> u32>,
3056 #[doc = "`void playdate->sound->sequence->play(SoundSequence* sequence, SequenceFinishedCallback finishCallback, void* userdata)`"]
3057 pub play: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3058 finishCallback: SequenceFinishedCallback,
3059 userdata: *mut core::ffi::c_void)>,
3060 #[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```"]
3061 pub stop: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence)>,
3062 #[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."]
3063 pub getCurrentStep: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3064 timeOffset: *mut core::ffi::c_int)
3065 -> core::ffi::c_int>,
3066 #[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."]
3067 pub setCurrentStep: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence,
3068 step: core::ffi::c_int,
3069 timeOffset: core::ffi::c_int,
3070 playNotes: core::ffi::c_int)>,
3071 #[doc = "`float playdate->sound->sequence->getTempo(SoundSequence* sequence)`"]
3072 pub getTempo: ::core::option::Option<unsafe extern "C" fn(seq: *mut SoundSequence) -> core::ffi::c_float>,
3073}
3074#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3075const _: () = {
3076 ["Size of playdate_sound_sequence"][::core::mem::size_of::<playdate_sound_sequence>() - 160usize];
3077 ["Alignment of playdate_sound_sequence"][::core::mem::align_of::<playdate_sound_sequence>() - 8usize];
3078 ["Offset of field: playdate_sound_sequence::newSequence"]
3079 [::core::mem::offset_of!(playdate_sound_sequence, newSequence) - 0usize];
3080 ["Offset of field: playdate_sound_sequence::freeSequence"]
3081 [::core::mem::offset_of!(playdate_sound_sequence, freeSequence) - 8usize];
3082 ["Offset of field: playdate_sound_sequence::loadMIDIFile"]
3083 [::core::mem::offset_of!(playdate_sound_sequence, loadMIDIFile) - 16usize];
3084 ["Offset of field: playdate_sound_sequence::getTime"]
3085 [::core::mem::offset_of!(playdate_sound_sequence, getTime) - 24usize];
3086 ["Offset of field: playdate_sound_sequence::setTime"]
3087 [::core::mem::offset_of!(playdate_sound_sequence, setTime) - 32usize];
3088 ["Offset of field: playdate_sound_sequence::setLoops"]
3089 [::core::mem::offset_of!(playdate_sound_sequence, setLoops) - 40usize];
3090 ["Offset of field: playdate_sound_sequence::getTempo_deprecated"]
3091 [::core::mem::offset_of!(playdate_sound_sequence, getTempo_deprecated) - 48usize];
3092 ["Offset of field: playdate_sound_sequence::setTempo"]
3093 [::core::mem::offset_of!(playdate_sound_sequence, setTempo) - 56usize];
3094 ["Offset of field: playdate_sound_sequence::getTrackCount"]
3095 [::core::mem::offset_of!(playdate_sound_sequence, getTrackCount) - 64usize];
3096 ["Offset of field: playdate_sound_sequence::addTrack"]
3097 [::core::mem::offset_of!(playdate_sound_sequence, addTrack) - 72usize];
3098 ["Offset of field: playdate_sound_sequence::getTrackAtIndex"]
3099 [::core::mem::offset_of!(playdate_sound_sequence, getTrackAtIndex) - 80usize];
3100 ["Offset of field: playdate_sound_sequence::setTrackAtIndex"]
3101 [::core::mem::offset_of!(playdate_sound_sequence, setTrackAtIndex) - 88usize];
3102 ["Offset of field: playdate_sound_sequence::allNotesOff"]
3103 [::core::mem::offset_of!(playdate_sound_sequence, allNotesOff) - 96usize];
3104 ["Offset of field: playdate_sound_sequence::isPlaying"]
3105 [::core::mem::offset_of!(playdate_sound_sequence, isPlaying) - 104usize];
3106 ["Offset of field: playdate_sound_sequence::getLength"]
3107 [::core::mem::offset_of!(playdate_sound_sequence, getLength) - 112usize];
3108 ["Offset of field: playdate_sound_sequence::play"]
3109 [::core::mem::offset_of!(playdate_sound_sequence, play) - 120usize];
3110 ["Offset of field: playdate_sound_sequence::stop"]
3111 [::core::mem::offset_of!(playdate_sound_sequence, stop) - 128usize];
3112 ["Offset of field: playdate_sound_sequence::getCurrentStep"]
3113 [::core::mem::offset_of!(playdate_sound_sequence, getCurrentStep) - 136usize];
3114 ["Offset of field: playdate_sound_sequence::setCurrentStep"]
3115 [::core::mem::offset_of!(playdate_sound_sequence, setCurrentStep) - 144usize];
3116 ["Offset of field: playdate_sound_sequence::getTempo"]
3117 [::core::mem::offset_of!(playdate_sound_sequence, getTempo) - 152usize];
3118};
3119#[repr(C)]
3120#[derive(Debug, Copy, Clone)]
3121#[must_use]
3122pub struct TwoPoleFilter {
3123 _unused: [u8; 0],
3124}
3125#[repr(u32)]
3126#[must_use]
3127#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3128pub enum TwoPoleFilterType {
3129 kFilterTypeLowPass = 0,
3130 kFilterTypeHighPass = 1,
3131 kFilterTypeBandPass = 2,
3132 kFilterTypeNotch = 3,
3133 kFilterTypePEQ = 4,
3134 kFilterTypeLowShelf = 5,
3135 kFilterTypeHighShelf = 6,
3136}
3137#[repr(C)]
3138#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3139#[must_use]
3140pub struct playdate_sound_effect_twopolefilter {
3141 #[doc = "`TwoPoleFilter* playdate->sound->effect->twopolefilter->newFilter(void)`\n\nCreates a new two pole filter effect."]
3142 pub newFilter: ::core::option::Option<unsafe extern "C" fn() -> *mut TwoPoleFilter>,
3143 #[doc = "`void playdate->sound->effect->twopolefilter->freeFilter(TwoPoleFilter* filter)`\n\nFrees the given filter."]
3144 pub freeFilter: ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter)>,
3145 #[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."]
3146 pub setType:
3147 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, type_: TwoPoleFilterType)>,
3148 #[doc = "`void playdate->sound->effect->twopolefilter->setFrequency(TwoPoleFilter* filter, float frequency)`\n\nSets the center/corner frequency of the filter. Value is in Hz."]
3149 pub setFrequency:
3150 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, frequency: core::ffi::c_float)>,
3151 #[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."]
3152 pub setFrequencyModulator:
3153 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, signal: *mut PDSynthSignalValue)>,
3154 #[doc = "`PDSynthSignalValue* playdate->sound->effect->twopolefilter->getFrequencyModulator(TwoPoleFilter* filter)`\n\nReturns the filter’s current frequency modulator."]
3155 pub getFrequencyModulator:
3156 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter) -> *mut PDSynthSignalValue>,
3157 #[doc = "`void playdate->sound->effect->twopolefilter->setGain(TwoPoleFilter* filter, float gain)`\n\nSets the filter gain."]
3158 pub setGain:
3159 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, gain: core::ffi::c_float)>,
3160 #[doc = "`void playdate->sound->effect->twopolefilter->setResonance(TwoPoleFilter* filter, float resonance)`\n\nSets the filter resonance."]
3161 pub setResonance:
3162 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, resonance: core::ffi::c_float)>,
3163 #[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."]
3164 pub setResonanceModulator:
3165 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter, signal: *mut PDSynthSignalValue)>,
3166 #[doc = "`PDSynthSignalValue* playdate->sound->effect->twopolefilter->getResonanceModulator(TwoPoleFilter* filter)`\n\nReturns the filter’s current resonance modulator."]
3167 pub getResonanceModulator:
3168 ::core::option::Option<unsafe extern "C" fn(filter: *mut TwoPoleFilter) -> *mut PDSynthSignalValue>,
3169}
3170#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3171const _: () = {
3172 ["Size of playdate_sound_effect_twopolefilter"]
3173 [::core::mem::size_of::<playdate_sound_effect_twopolefilter>() - 80usize];
3174 ["Alignment of playdate_sound_effect_twopolefilter"]
3175 [::core::mem::align_of::<playdate_sound_effect_twopolefilter>() - 8usize];
3176 ["Offset of field: playdate_sound_effect_twopolefilter::newFilter"]
3177 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, newFilter) - 0usize];
3178 ["Offset of field: playdate_sound_effect_twopolefilter::freeFilter"]
3179 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, freeFilter) - 8usize];
3180 ["Offset of field: playdate_sound_effect_twopolefilter::setType"]
3181 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setType) - 16usize];
3182 ["Offset of field: playdate_sound_effect_twopolefilter::setFrequency"]
3183 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setFrequency) - 24usize];
3184 ["Offset of field: playdate_sound_effect_twopolefilter::setFrequencyModulator"]
3185 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setFrequencyModulator) - 32usize];
3186 ["Offset of field: playdate_sound_effect_twopolefilter::getFrequencyModulator"]
3187 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, getFrequencyModulator) - 40usize];
3188 ["Offset of field: playdate_sound_effect_twopolefilter::setGain"]
3189 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setGain) - 48usize];
3190 ["Offset of field: playdate_sound_effect_twopolefilter::setResonance"]
3191 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setResonance) - 56usize];
3192 ["Offset of field: playdate_sound_effect_twopolefilter::setResonanceModulator"]
3193 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, setResonanceModulator) - 64usize];
3194 ["Offset of field: playdate_sound_effect_twopolefilter::getResonanceModulator"]
3195 [::core::mem::offset_of!(playdate_sound_effect_twopolefilter, getResonanceModulator) - 72usize];
3196};
3197#[repr(C)]
3198#[derive(Debug, Copy, Clone)]
3199#[must_use]
3200pub struct OnePoleFilter {
3201 _unused: [u8; 0],
3202}
3203#[repr(C)]
3204#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3205#[must_use]
3206pub struct playdate_sound_effect_onepolefilter {
3207 #[doc = "`OnePoleFilter* playdate->sound->effect->onepolefilter->newFilter(void)`\n\nCreates a new one pole filter."]
3208 pub newFilter: ::core::option::Option<unsafe extern "C" fn() -> *mut OnePoleFilter>,
3209 #[doc = "`void playdate->sound->effect->onepolefilter->freeFilter(OnePoleFilter* filter)`\n\nFrees the filter."]
3210 pub freeFilter: ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter)>,
3211 #[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."]
3212 pub setParameter:
3213 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter, parameter: core::ffi::c_float)>,
3214 #[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."]
3215 pub setParameterModulator:
3216 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter, signal: *mut PDSynthSignalValue)>,
3217 #[doc = "`PDSynthSignalValue* playdate->sound->effect->onepolefilter->getParameterModulator(OnePoleFilter* filter)`\n\nReturns the filter’s current parameter modulator."]
3218 pub getParameterModulator:
3219 ::core::option::Option<unsafe extern "C" fn(filter: *mut OnePoleFilter) -> *mut PDSynthSignalValue>,
3220}
3221#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3222const _: () = {
3223 ["Size of playdate_sound_effect_onepolefilter"]
3224 [::core::mem::size_of::<playdate_sound_effect_onepolefilter>() - 40usize];
3225 ["Alignment of playdate_sound_effect_onepolefilter"]
3226 [::core::mem::align_of::<playdate_sound_effect_onepolefilter>() - 8usize];
3227 ["Offset of field: playdate_sound_effect_onepolefilter::newFilter"]
3228 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, newFilter) - 0usize];
3229 ["Offset of field: playdate_sound_effect_onepolefilter::freeFilter"]
3230 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, freeFilter) - 8usize];
3231 ["Offset of field: playdate_sound_effect_onepolefilter::setParameter"]
3232 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, setParameter) - 16usize];
3233 ["Offset of field: playdate_sound_effect_onepolefilter::setParameterModulator"]
3234 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, setParameterModulator) - 24usize];
3235 ["Offset of field: playdate_sound_effect_onepolefilter::getParameterModulator"]
3236 [::core::mem::offset_of!(playdate_sound_effect_onepolefilter, getParameterModulator) - 32usize];
3237};
3238#[repr(C)]
3239#[derive(Debug, Copy, Clone)]
3240#[must_use]
3241pub struct BitCrusher {
3242 _unused: [u8; 0],
3243}
3244#[repr(C)]
3245#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3246#[must_use]
3247pub struct playdate_sound_effect_bitcrusher {
3248 #[doc = "`BitCrusher* playdate->sound->effect->bitcrusher->newBitCrusher(void)`\n\nReturns a new BitCrusher effect."]
3249 pub newBitCrusher: ::core::option::Option<unsafe extern "C" fn() -> *mut BitCrusher>,
3250 #[doc = "`void playdate->sound->effect->bitcrusher->freeBitCrusher(BitCrusher* filter)`\n\nFrees the given effect."]
3251 pub freeBitCrusher: ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher)>,
3252 #[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)."]
3253 pub setAmount:
3254 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, amount: core::ffi::c_float)>,
3255 #[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."]
3256 pub setAmountModulator:
3257 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, signal: *mut PDSynthSignalValue)>,
3258 #[doc = "`PDSynthSignalValue* playdate->sound->effect->bitcrusher->getAmountModulator(BitCrusher* filter)`\n\nReturns the currently set modulator."]
3259 pub getAmountModulator:
3260 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher) -> *mut PDSynthSignalValue>,
3261 #[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."]
3262 pub setUndersampling:
3263 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, undersampling: core::ffi::c_float)>,
3264 #[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."]
3265 pub setUndersampleModulator:
3266 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher, signal: *mut PDSynthSignalValue)>,
3267 #[doc = "`PDSynthSignalValue* playdate->sound->effect->bitcrusher->getUndersampleModulator(BitCrusher* filter)`\n\nReturns the currently set modulator."]
3268 pub getUndersampleModulator:
3269 ::core::option::Option<unsafe extern "C" fn(filter: *mut BitCrusher) -> *mut PDSynthSignalValue>,
3270}
3271#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3272const _: () = {
3273 ["Size of playdate_sound_effect_bitcrusher"]
3274 [::core::mem::size_of::<playdate_sound_effect_bitcrusher>() - 64usize];
3275 ["Alignment of playdate_sound_effect_bitcrusher"]
3276 [::core::mem::align_of::<playdate_sound_effect_bitcrusher>() - 8usize];
3277 ["Offset of field: playdate_sound_effect_bitcrusher::newBitCrusher"]
3278 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, newBitCrusher) - 0usize];
3279 ["Offset of field: playdate_sound_effect_bitcrusher::freeBitCrusher"]
3280 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, freeBitCrusher) - 8usize];
3281 ["Offset of field: playdate_sound_effect_bitcrusher::setAmount"]
3282 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setAmount) - 16usize];
3283 ["Offset of field: playdate_sound_effect_bitcrusher::setAmountModulator"]
3284 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setAmountModulator) - 24usize];
3285 ["Offset of field: playdate_sound_effect_bitcrusher::getAmountModulator"]
3286 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, getAmountModulator) - 32usize];
3287 ["Offset of field: playdate_sound_effect_bitcrusher::setUndersampling"]
3288 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setUndersampling) - 40usize];
3289 ["Offset of field: playdate_sound_effect_bitcrusher::setUndersampleModulator"]
3290 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, setUndersampleModulator) - 48usize];
3291 ["Offset of field: playdate_sound_effect_bitcrusher::getUndersampleModulator"]
3292 [::core::mem::offset_of!(playdate_sound_effect_bitcrusher, getUndersampleModulator) - 56usize];
3293};
3294#[repr(C)]
3295#[derive(Debug, Copy, Clone)]
3296#[must_use]
3297pub struct RingModulator {
3298 _unused: [u8; 0],
3299}
3300#[repr(C)]
3301#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3302#[must_use]
3303pub struct playdate_sound_effect_ringmodulator {
3304 #[doc = "`RingModulator* playdate->sound->effect->ringmodulator->newRingmod(void)`\n\nReturns a new ring modulator effect."]
3305 pub newRingmod: ::core::option::Option<unsafe extern "C" fn() -> *mut RingModulator>,
3306 pub freeRingmod: ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator)>,
3307 #[doc = "`void playdate->sound->effect->ringmodulator->setFrequency(RingModulator* filter, float frequency)`\n\nSets the frequency of the modulation signal."]
3308 pub setFrequency:
3309 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator, frequency: core::ffi::c_float)>,
3310 #[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."]
3311 pub setFrequencyModulator:
3312 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator, signal: *mut PDSynthSignalValue)>,
3313 #[doc = "`PDSynthSignalValue* playdate->sound->effect->ringmodulator->getFrequencyModulator(RingModulator* filter)`\n\nReturns the currently set frequency modulator."]
3314 pub getFrequencyModulator:
3315 ::core::option::Option<unsafe extern "C" fn(filter: *mut RingModulator) -> *mut PDSynthSignalValue>,
3316}
3317#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3318const _: () = {
3319 ["Size of playdate_sound_effect_ringmodulator"]
3320 [::core::mem::size_of::<playdate_sound_effect_ringmodulator>() - 40usize];
3321 ["Alignment of playdate_sound_effect_ringmodulator"]
3322 [::core::mem::align_of::<playdate_sound_effect_ringmodulator>() - 8usize];
3323 ["Offset of field: playdate_sound_effect_ringmodulator::newRingmod"]
3324 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, newRingmod) - 0usize];
3325 ["Offset of field: playdate_sound_effect_ringmodulator::freeRingmod"]
3326 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, freeRingmod) - 8usize];
3327 ["Offset of field: playdate_sound_effect_ringmodulator::setFrequency"]
3328 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, setFrequency) - 16usize];
3329 ["Offset of field: playdate_sound_effect_ringmodulator::setFrequencyModulator"]
3330 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, setFrequencyModulator) - 24usize];
3331 ["Offset of field: playdate_sound_effect_ringmodulator::getFrequencyModulator"]
3332 [::core::mem::offset_of!(playdate_sound_effect_ringmodulator, getFrequencyModulator) - 32usize];
3333};
3334#[repr(C)]
3335#[derive(Debug, Copy, Clone)]
3336#[must_use]
3337pub struct DelayLine {
3338 _unused: [u8; 0],
3339}
3340#[repr(C)]
3341#[derive(Debug, Copy, Clone)]
3342#[must_use]
3343pub struct DelayLineTap {
3344 _unused: [u8; 0],
3345}
3346#[repr(C)]
3347#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3348#[must_use]
3349pub struct playdate_sound_effect_delayline {
3350 #[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."]
3351 pub newDelayLine: ::core::option::Option<unsafe extern "C" fn(length: core::ffi::c_int,
3352 stereo: core::ffi::c_int)
3353 -> *mut DelayLine>,
3354 #[doc = "`void playdate->sound->effect->delayline->freeDelayLine(DelayLine* delay)`\n\nFrees the delay line."]
3355 pub freeDelayLine: ::core::option::Option<unsafe extern "C" fn(filter: *mut DelayLine)>,
3356 #[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."]
3357 pub setLength: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine, frames: core::ffi::c_int)>,
3358 #[doc = "`void playdate->sound->effect->delayline->setFeedback(DelayLine* d, float fb)`\n\nSets the feedback level of the delay line."]
3359 pub setFeedback: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine, fb: core::ffi::c_float)>,
3360 #[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."]
3361 pub addTap: ::core::option::Option<unsafe extern "C" fn(d: *mut DelayLine,
3362 delay: core::ffi::c_int)
3363 -> *mut DelayLineTap>,
3364 #[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."]
3365 pub freeTap: ::core::option::Option<unsafe extern "C" fn(tap: *mut DelayLineTap)>,
3366 #[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."]
3367 pub setTapDelay: ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, frames: core::ffi::c_int)>,
3368 #[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."]
3369 pub setTapDelayModulator:
3370 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, mod_: *mut PDSynthSignalValue)>,
3371 #[doc = "`PDSynthSignalValue* playdate->sound->effect->delayline->getTapDelayModulator(DelayLineTap* tap)`\n\nReturns the current delay modulator."]
3372 pub getTapDelayModulator:
3373 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap) -> *mut PDSynthSignalValue>,
3374 #[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."]
3375 pub setTapChannelsFlipped:
3376 ::core::option::Option<unsafe extern "C" fn(t: *mut DelayLineTap, flip: core::ffi::c_int)>,
3377}
3378#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3379const _: () = {
3380 ["Size of playdate_sound_effect_delayline"]
3381 [::core::mem::size_of::<playdate_sound_effect_delayline>() - 80usize];
3382 ["Alignment of playdate_sound_effect_delayline"]
3383 [::core::mem::align_of::<playdate_sound_effect_delayline>() - 8usize];
3384 ["Offset of field: playdate_sound_effect_delayline::newDelayLine"]
3385 [::core::mem::offset_of!(playdate_sound_effect_delayline, newDelayLine) - 0usize];
3386 ["Offset of field: playdate_sound_effect_delayline::freeDelayLine"]
3387 [::core::mem::offset_of!(playdate_sound_effect_delayline, freeDelayLine) - 8usize];
3388 ["Offset of field: playdate_sound_effect_delayline::setLength"]
3389 [::core::mem::offset_of!(playdate_sound_effect_delayline, setLength) - 16usize];
3390 ["Offset of field: playdate_sound_effect_delayline::setFeedback"]
3391 [::core::mem::offset_of!(playdate_sound_effect_delayline, setFeedback) - 24usize];
3392 ["Offset of field: playdate_sound_effect_delayline::addTap"]
3393 [::core::mem::offset_of!(playdate_sound_effect_delayline, addTap) - 32usize];
3394 ["Offset of field: playdate_sound_effect_delayline::freeTap"]
3395 [::core::mem::offset_of!(playdate_sound_effect_delayline, freeTap) - 40usize];
3396 ["Offset of field: playdate_sound_effect_delayline::setTapDelay"]
3397 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapDelay) - 48usize];
3398 ["Offset of field: playdate_sound_effect_delayline::setTapDelayModulator"]
3399 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapDelayModulator) - 56usize];
3400 ["Offset of field: playdate_sound_effect_delayline::getTapDelayModulator"]
3401 [::core::mem::offset_of!(playdate_sound_effect_delayline, getTapDelayModulator) - 64usize];
3402 ["Offset of field: playdate_sound_effect_delayline::setTapChannelsFlipped"]
3403 [::core::mem::offset_of!(playdate_sound_effect_delayline, setTapChannelsFlipped) - 72usize];
3404};
3405#[repr(C)]
3406#[derive(Debug, Copy, Clone)]
3407#[must_use]
3408pub struct Overdrive {
3409 _unused: [u8; 0],
3410}
3411#[repr(C)]
3412#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3413#[must_use]
3414pub struct playdate_sound_effect_overdrive {
3415 #[doc = "`Overdrive* playdate->sound->effect->overdrive->newOverdrive(void)`\n\nReturns a new overdrive effect."]
3416 pub newOverdrive: ::core::option::Option<unsafe extern "C" fn() -> *mut Overdrive>,
3417 #[doc = "`void playdate->sound->effect->overdrive->freeOverdrive(Overdrive* filter)`\n\nFrees the given effect."]
3418 pub freeOverdrive: ::core::option::Option<unsafe extern "C" fn(filter: *mut Overdrive)>,
3419 #[doc = "`void playdate->sound->effect->overdrive->setGain(Overdrive* filter, float gain)`\n\nSets the gain of the overdrive effect."]
3420 pub setGain: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, gain: core::ffi::c_float)>,
3421 #[doc = "`void playdate->sound->effect->overdrive->setLimit(Overdrive* filter, float limit)`\n\nSets the level where the amplified input clips."]
3422 pub setLimit: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, limit: core::ffi::c_float)>,
3423 #[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."]
3424 pub setLimitModulator:
3425 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, mod_: *mut PDSynthSignalValue)>,
3426 #[doc = "`PDSynthSignalValue* playdate->sound->effect->overdrive->getLimitModulator(RingMoOverdrivedulator* filter)`\n\nReturns the currently set limit modulator."]
3427 pub getLimitModulator:
3428 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive) -> *mut PDSynthSignalValue>,
3429 #[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."]
3430 pub setOffset: ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, offset: core::ffi::c_float)>,
3431 #[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."]
3432 pub setOffsetModulator:
3433 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive, mod_: *mut PDSynthSignalValue)>,
3434 #[doc = "`PDSynthSignalValue* playdate->sound->effect->overdrive->getOffsetModulator(RingMoOverdrivedulator* filter)`\n\nReturns the currently set offset modulator."]
3435 pub getOffsetModulator:
3436 ::core::option::Option<unsafe extern "C" fn(o: *mut Overdrive) -> *mut PDSynthSignalValue>,
3437}
3438#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3439const _: () = {
3440 ["Size of playdate_sound_effect_overdrive"]
3441 [::core::mem::size_of::<playdate_sound_effect_overdrive>() - 72usize];
3442 ["Alignment of playdate_sound_effect_overdrive"]
3443 [::core::mem::align_of::<playdate_sound_effect_overdrive>() - 8usize];
3444 ["Offset of field: playdate_sound_effect_overdrive::newOverdrive"]
3445 [::core::mem::offset_of!(playdate_sound_effect_overdrive, newOverdrive) - 0usize];
3446 ["Offset of field: playdate_sound_effect_overdrive::freeOverdrive"]
3447 [::core::mem::offset_of!(playdate_sound_effect_overdrive, freeOverdrive) - 8usize];
3448 ["Offset of field: playdate_sound_effect_overdrive::setGain"]
3449 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setGain) - 16usize];
3450 ["Offset of field: playdate_sound_effect_overdrive::setLimit"]
3451 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setLimit) - 24usize];
3452 ["Offset of field: playdate_sound_effect_overdrive::setLimitModulator"]
3453 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setLimitModulator) - 32usize];
3454 ["Offset of field: playdate_sound_effect_overdrive::getLimitModulator"]
3455 [::core::mem::offset_of!(playdate_sound_effect_overdrive, getLimitModulator) - 40usize];
3456 ["Offset of field: playdate_sound_effect_overdrive::setOffset"]
3457 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setOffset) - 48usize];
3458 ["Offset of field: playdate_sound_effect_overdrive::setOffsetModulator"]
3459 [::core::mem::offset_of!(playdate_sound_effect_overdrive, setOffsetModulator) - 56usize];
3460 ["Offset of field: playdate_sound_effect_overdrive::getOffsetModulator"]
3461 [::core::mem::offset_of!(playdate_sound_effect_overdrive, getOffsetModulator) - 64usize];
3462};
3463#[repr(C)]
3464#[derive(Debug, Copy, Clone)]
3465#[must_use]
3466pub struct SoundEffect {
3467 _unused: [u8; 0],
3468}
3469pub type effectProc = ::core::option::Option<unsafe extern "C" fn(e: *mut SoundEffect,
3470 left: *mut i32,
3471 right: *mut i32,
3472 nsamples: core::ffi::c_int,
3473 bufactive: core::ffi::c_int)
3474 -> core::ffi::c_int>;
3475#[repr(C)]
3476#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3477#[must_use]
3478pub struct playdate_sound_effect {
3479 #[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."]
3480 pub newEffect: ::core::option::Option<unsafe extern "C" fn(proc_: effectProc,
3481 userdata: *mut core::ffi::c_void)
3482 -> *mut SoundEffect>,
3483 #[doc = "`void playdate->sound->effect->freeEffect(SoundEffect* effect)`\n\nFrees the given effect."]
3484 pub freeEffect: ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect)>,
3485 #[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)."]
3486 pub setMix: ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, level: core::ffi::c_float)>,
3487 #[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."]
3488 pub setMixModulator:
3489 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, signal: *mut PDSynthSignalValue)>,
3490 #[doc = "`PDSynthSignalValue* playdate->sound->effect->getMixModulator(SoundEffect* effect)`\n\nReturns the current mix modulator for the effect."]
3491 pub getMixModulator:
3492 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect) -> *mut PDSynthSignalValue>,
3493 #[doc = "`void playdate->sound->effect->setUserdata(SoundEffect* effect, void* userdata)`"]
3494 pub setUserdata:
3495 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect, userdata: *mut core::ffi::c_void)>,
3496 #[doc = "`void* playdate->sound->effect->getUserdata(SoundEffect* effect)`\n\nSets or gets a userdata value for the effect."]
3497 pub getUserdata:
3498 ::core::option::Option<unsafe extern "C" fn(effect: *mut SoundEffect) -> *mut core::ffi::c_void>,
3499 pub twopolefilter: *const playdate_sound_effect_twopolefilter,
3500 pub onepolefilter: *const playdate_sound_effect_onepolefilter,
3501 pub bitcrusher: *const playdate_sound_effect_bitcrusher,
3502 pub ringmodulator: *const playdate_sound_effect_ringmodulator,
3503 pub delayline: *const playdate_sound_effect_delayline,
3504 pub overdrive: *const playdate_sound_effect_overdrive,
3505}
3506#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3507const _: () = {
3508 ["Size of playdate_sound_effect"][::core::mem::size_of::<playdate_sound_effect>() - 104usize];
3509 ["Alignment of playdate_sound_effect"][::core::mem::align_of::<playdate_sound_effect>() - 8usize];
3510 ["Offset of field: playdate_sound_effect::newEffect"]
3511 [::core::mem::offset_of!(playdate_sound_effect, newEffect) - 0usize];
3512 ["Offset of field: playdate_sound_effect::freeEffect"]
3513 [::core::mem::offset_of!(playdate_sound_effect, freeEffect) - 8usize];
3514 ["Offset of field: playdate_sound_effect::setMix"]
3515 [::core::mem::offset_of!(playdate_sound_effect, setMix) - 16usize];
3516 ["Offset of field: playdate_sound_effect::setMixModulator"]
3517 [::core::mem::offset_of!(playdate_sound_effect, setMixModulator) - 24usize];
3518 ["Offset of field: playdate_sound_effect::getMixModulator"]
3519 [::core::mem::offset_of!(playdate_sound_effect, getMixModulator) - 32usize];
3520 ["Offset of field: playdate_sound_effect::setUserdata"]
3521 [::core::mem::offset_of!(playdate_sound_effect, setUserdata) - 40usize];
3522 ["Offset of field: playdate_sound_effect::getUserdata"]
3523 [::core::mem::offset_of!(playdate_sound_effect, getUserdata) - 48usize];
3524 ["Offset of field: playdate_sound_effect::twopolefilter"]
3525 [::core::mem::offset_of!(playdate_sound_effect, twopolefilter) - 56usize];
3526 ["Offset of field: playdate_sound_effect::onepolefilter"]
3527 [::core::mem::offset_of!(playdate_sound_effect, onepolefilter) - 64usize];
3528 ["Offset of field: playdate_sound_effect::bitcrusher"]
3529 [::core::mem::offset_of!(playdate_sound_effect, bitcrusher) - 72usize];
3530 ["Offset of field: playdate_sound_effect::ringmodulator"]
3531 [::core::mem::offset_of!(playdate_sound_effect, ringmodulator) - 80usize];
3532 ["Offset of field: playdate_sound_effect::delayline"]
3533 [::core::mem::offset_of!(playdate_sound_effect, delayline) - 88usize];
3534 ["Offset of field: playdate_sound_effect::overdrive"]
3535 [::core::mem::offset_of!(playdate_sound_effect, overdrive) - 96usize];
3536};
3537impl Default for playdate_sound_effect {
3538 fn default() -> Self {
3539 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3540 unsafe {
3541 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3542 s.assume_init()
3543 }
3544 }
3545}
3546#[repr(C)]
3547#[derive(Debug, Copy, Clone)]
3548#[must_use]
3549pub struct SoundChannel {
3550 _unused: [u8; 0],
3551}
3552pub type AudioSourceFunction = ::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void,
3553 left: *mut i16,
3554 right: *mut i16,
3555 len: core::ffi::c_int)
3556 -> core::ffi::c_int>;
3557#[repr(C)]
3558#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3559#[must_use]
3560pub struct playdate_sound_channel {
3561 #[doc = "`SoundChannel* playdate->sound->channel->newChannel(void)`\n\nReturns a new *SoundChannel* object."]
3562 pub newChannel: ::core::option::Option<unsafe extern "C" fn() -> *mut SoundChannel>,
3563 #[doc = "`void playdate->sound->channel->freeChannel(SoundChannel* channel)`\n\nFrees the given *SoundChannel*."]
3564 pub freeChannel: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel)>,
3565 #[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."]
3566 pub addSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3567 source: *mut SoundSource)
3568 -> core::ffi::c_int>,
3569 #[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."]
3570 pub removeSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3571 source: *mut SoundSource)
3572 -> core::ffi::c_int>,
3573 #[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."]
3574 pub addCallbackSource: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel,
3575 callback: AudioSourceFunction,
3576 context: *mut core::ffi::c_void,
3577 stereo: core::ffi::c_int)
3578 -> *mut SoundSource>,
3579 #[doc = "`void playdate->sound->channel->addEffect(SoundChannel* channel, SoundEffect* effect)`\n\nAdds a [SoundEffect](#f-sound.effect) to the channel."]
3580 pub addEffect:
3581 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, effect: *mut SoundEffect)>,
3582 #[doc = "`void playdate->sound->channel->removeEffect(SoundChannel* channel, SoundEffect* effect)`\n\nRemoves a [SoundEffect](#f-sound.effect) from the channel."]
3583 pub removeEffect:
3584 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, effect: *mut SoundEffect)>,
3585 #[doc = "`void playdate->sound->channel->setVolume(SoundChannel* channel, float volume)`\n\nSets the volume for the channel, in the range [0-1]."]
3586 pub setVolume:
3587 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, volume: core::ffi::c_float)>,
3588 #[doc = "`float playdate->sound->channel->getVolume(SoundChannel* channel)`\n\nGets the volume for the channel, in the range [0-1]."]
3589 pub getVolume: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> core::ffi::c_float>,
3590 #[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."]
3591 pub setVolumeModulator:
3592 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, mod_: *mut PDSynthSignalValue)>,
3593 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getVolumeModulator(SoundChannel* channel)`\n\nGets a [signal](#C-sound.signal) modulating the channel volume."]
3594 pub getVolumeModulator:
3595 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3596 #[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."]
3597 pub setPan: ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, pan: core::ffi::c_float)>,
3598 #[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."]
3599 pub setPanModulator:
3600 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel, mod_: *mut PDSynthSignalValue)>,
3601 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getPanModulator(SoundChannel* channel)`\n\nGets a [signal](#C-sound.signal) modulating the channel pan."]
3602 pub getPanModulator:
3603 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3604 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getDryLevelSignal(SoundChannel* channel)`\n\nReturns a signal that follows the volume of the channel before effects are applied."]
3605 pub getDryLevelSignal:
3606 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3607 #[doc = "`PDSynthSignalValue* playdate->sound->channel->getWetLevelSignal(SoundChannel* channel)`\n\nReturns a signal that follows the volume of the channel after effects are applied."]
3608 pub getWetLevelSignal:
3609 ::core::option::Option<unsafe extern "C" fn(channel: *mut SoundChannel) -> *mut PDSynthSignalValue>,
3610}
3611#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3612const _: () = {
3613 ["Size of playdate_sound_channel"][::core::mem::size_of::<playdate_sound_channel>() - 128usize];
3614 ["Alignment of playdate_sound_channel"][::core::mem::align_of::<playdate_sound_channel>() - 8usize];
3615 ["Offset of field: playdate_sound_channel::newChannel"]
3616 [::core::mem::offset_of!(playdate_sound_channel, newChannel) - 0usize];
3617 ["Offset of field: playdate_sound_channel::freeChannel"]
3618 [::core::mem::offset_of!(playdate_sound_channel, freeChannel) - 8usize];
3619 ["Offset of field: playdate_sound_channel::addSource"]
3620 [::core::mem::offset_of!(playdate_sound_channel, addSource) - 16usize];
3621 ["Offset of field: playdate_sound_channel::removeSource"]
3622 [::core::mem::offset_of!(playdate_sound_channel, removeSource) - 24usize];
3623 ["Offset of field: playdate_sound_channel::addCallbackSource"]
3624 [::core::mem::offset_of!(playdate_sound_channel, addCallbackSource) - 32usize];
3625 ["Offset of field: playdate_sound_channel::addEffect"]
3626 [::core::mem::offset_of!(playdate_sound_channel, addEffect) - 40usize];
3627 ["Offset of field: playdate_sound_channel::removeEffect"]
3628 [::core::mem::offset_of!(playdate_sound_channel, removeEffect) - 48usize];
3629 ["Offset of field: playdate_sound_channel::setVolume"]
3630 [::core::mem::offset_of!(playdate_sound_channel, setVolume) - 56usize];
3631 ["Offset of field: playdate_sound_channel::getVolume"]
3632 [::core::mem::offset_of!(playdate_sound_channel, getVolume) - 64usize];
3633 ["Offset of field: playdate_sound_channel::setVolumeModulator"]
3634 [::core::mem::offset_of!(playdate_sound_channel, setVolumeModulator) - 72usize];
3635 ["Offset of field: playdate_sound_channel::getVolumeModulator"]
3636 [::core::mem::offset_of!(playdate_sound_channel, getVolumeModulator) - 80usize];
3637 ["Offset of field: playdate_sound_channel::setPan"]
3638 [::core::mem::offset_of!(playdate_sound_channel, setPan) - 88usize];
3639 ["Offset of field: playdate_sound_channel::setPanModulator"]
3640 [::core::mem::offset_of!(playdate_sound_channel, setPanModulator) - 96usize];
3641 ["Offset of field: playdate_sound_channel::getPanModulator"]
3642 [::core::mem::offset_of!(playdate_sound_channel, getPanModulator) - 104usize];
3643 ["Offset of field: playdate_sound_channel::getDryLevelSignal"]
3644 [::core::mem::offset_of!(playdate_sound_channel, getDryLevelSignal) - 112usize];
3645 ["Offset of field: playdate_sound_channel::getWetLevelSignal"]
3646 [::core::mem::offset_of!(playdate_sound_channel, getWetLevelSignal) - 120usize];
3647};
3648pub type RecordCallback = ::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void,
3649 buffer: *mut i16,
3650 length: core::ffi::c_int)
3651 -> core::ffi::c_int>;
3652#[repr(u32)]
3653#[must_use]
3654#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3655pub enum MicSource {
3656 kMicInputAutodetect = 0,
3657 kMicInputInternal = 1,
3658 kMicInputHeadset = 2,
3659}
3660#[repr(C)]
3661#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3662#[must_use]
3663pub 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 > , }
3664#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3665const _: () = {
3666 ["Size of playdate_sound"][::core::mem::size_of::<playdate_sound>() - 192usize];
3667 ["Alignment of playdate_sound"][::core::mem::align_of::<playdate_sound>() - 8usize];
3668 ["Offset of field: playdate_sound::channel"][::core::mem::offset_of!(playdate_sound, channel) - 0usize];
3669 ["Offset of field: playdate_sound::fileplayer"][::core::mem::offset_of!(playdate_sound, fileplayer) - 8usize];
3670 ["Offset of field: playdate_sound::sample"][::core::mem::offset_of!(playdate_sound, sample) - 16usize];
3671 ["Offset of field: playdate_sound::sampleplayer"]
3672 [::core::mem::offset_of!(playdate_sound, sampleplayer) - 24usize];
3673 ["Offset of field: playdate_sound::synth"][::core::mem::offset_of!(playdate_sound, synth) - 32usize];
3674 ["Offset of field: playdate_sound::sequence"][::core::mem::offset_of!(playdate_sound, sequence) - 40usize];
3675 ["Offset of field: playdate_sound::effect"][::core::mem::offset_of!(playdate_sound, effect) - 48usize];
3676 ["Offset of field: playdate_sound::lfo"][::core::mem::offset_of!(playdate_sound, lfo) - 56usize];
3677 ["Offset of field: playdate_sound::envelope"][::core::mem::offset_of!(playdate_sound, envelope) - 64usize];
3678 ["Offset of field: playdate_sound::source"][::core::mem::offset_of!(playdate_sound, source) - 72usize];
3679 ["Offset of field: playdate_sound::controlsignal"]
3680 [::core::mem::offset_of!(playdate_sound, controlsignal) - 80usize];
3681 ["Offset of field: playdate_sound::track"][::core::mem::offset_of!(playdate_sound, track) - 88usize];
3682 ["Offset of field: playdate_sound::instrument"][::core::mem::offset_of!(playdate_sound, instrument) - 96usize];
3683 ["Offset of field: playdate_sound::getCurrentTime"]
3684 [::core::mem::offset_of!(playdate_sound, getCurrentTime) - 104usize];
3685 ["Offset of field: playdate_sound::addSource"][::core::mem::offset_of!(playdate_sound, addSource) - 112usize];
3686 ["Offset of field: playdate_sound::getDefaultChannel"]
3687 [::core::mem::offset_of!(playdate_sound, getDefaultChannel) - 120usize];
3688 ["Offset of field: playdate_sound::addChannel"]
3689 [::core::mem::offset_of!(playdate_sound, addChannel) - 128usize];
3690 ["Offset of field: playdate_sound::removeChannel"]
3691 [::core::mem::offset_of!(playdate_sound, removeChannel) - 136usize];
3692 ["Offset of field: playdate_sound::setMicCallback"]
3693 [::core::mem::offset_of!(playdate_sound, setMicCallback) - 144usize];
3694 ["Offset of field: playdate_sound::getHeadphoneState"]
3695 [::core::mem::offset_of!(playdate_sound, getHeadphoneState) - 152usize];
3696 ["Offset of field: playdate_sound::setOutputsActive"]
3697 [::core::mem::offset_of!(playdate_sound, setOutputsActive) - 160usize];
3698 ["Offset of field: playdate_sound::removeSource"]
3699 [::core::mem::offset_of!(playdate_sound, removeSource) - 168usize];
3700 ["Offset of field: playdate_sound::signal"][::core::mem::offset_of!(playdate_sound, signal) - 176usize];
3701 ["Offset of field: playdate_sound::getError"][::core::mem::offset_of!(playdate_sound, getError) - 184usize];
3702};
3703impl Default for playdate_sound {
3704 fn default() -> Self {
3705 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3706 unsafe {
3707 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3708 s.assume_init()
3709 }
3710 }
3711}
3712#[repr(C)]
3713#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3714#[must_use]
3715pub struct playdate_display {
3716 #[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."]
3717 pub getWidth: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
3718 #[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."]
3719 pub getHeight: ::core::option::Option<unsafe extern "C" fn() -> core::ffi::c_int>,
3720 #[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."]
3721 pub setRefreshRate: ::core::option::Option<unsafe extern "C" fn(rate: core::ffi::c_float)>,
3722 #[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."]
3723 pub setInverted: ::core::option::Option<unsafe extern "C" fn(flag: core::ffi::c_int)>,
3724 #[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."]
3725 pub setScale: ::core::option::Option<unsafe extern "C" fn(s: core::ffi::c_uint)>,
3726 #[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."]
3727 pub setMosaic: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_uint, y: core::ffi::c_uint)>,
3728 #[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."]
3729 pub setFlipped: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int, y: core::ffi::c_int)>,
3730 #[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."]
3731 pub setOffset: ::core::option::Option<unsafe extern "C" fn(x: core::ffi::c_int, y: core::ffi::c_int)>,
3732}
3733#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3734const _: () = {
3735 ["Size of playdate_display"][::core::mem::size_of::<playdate_display>() - 64usize];
3736 ["Alignment of playdate_display"][::core::mem::align_of::<playdate_display>() - 8usize];
3737 ["Offset of field: playdate_display::getWidth"][::core::mem::offset_of!(playdate_display, getWidth) - 0usize];
3738 ["Offset of field: playdate_display::getHeight"]
3739 [::core::mem::offset_of!(playdate_display, getHeight) - 8usize];
3740 ["Offset of field: playdate_display::setRefreshRate"]
3741 [::core::mem::offset_of!(playdate_display, setRefreshRate) - 16usize];
3742 ["Offset of field: playdate_display::setInverted"]
3743 [::core::mem::offset_of!(playdate_display, setInverted) - 24usize];
3744 ["Offset of field: playdate_display::setScale"][::core::mem::offset_of!(playdate_display, setScale) - 32usize];
3745 ["Offset of field: playdate_display::setMosaic"]
3746 [::core::mem::offset_of!(playdate_display, setMosaic) - 40usize];
3747 ["Offset of field: playdate_display::setFlipped"]
3748 [::core::mem::offset_of!(playdate_display, setFlipped) - 48usize];
3749 ["Offset of field: playdate_display::setOffset"]
3750 [::core::mem::offset_of!(playdate_display, setOffset) - 56usize];
3751};
3752#[repr(C)]
3753#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3754#[must_use]
3755pub struct PDScore {
3756 pub rank: u32,
3757 pub value: u32,
3758 pub player: *mut core::ffi::c_char,
3759}
3760#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3761const _: () = {
3762 ["Size of PDScore"][::core::mem::size_of::<PDScore>() - 16usize];
3763 ["Alignment of PDScore"][::core::mem::align_of::<PDScore>() - 8usize];
3764 ["Offset of field: PDScore::rank"][::core::mem::offset_of!(PDScore, rank) - 0usize];
3765 ["Offset of field: PDScore::value"][::core::mem::offset_of!(PDScore, value) - 4usize];
3766 ["Offset of field: PDScore::player"][::core::mem::offset_of!(PDScore, player) - 8usize];
3767};
3768impl Default for PDScore {
3769 fn default() -> Self {
3770 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3771 unsafe {
3772 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3773 s.assume_init()
3774 }
3775 }
3776}
3777#[repr(C)]
3778#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3779#[must_use]
3780pub struct PDScoresList {
3781 pub boardID: *mut core::ffi::c_char,
3782 pub count: core::ffi::c_uint,
3783 pub lastUpdated: u32,
3784 pub playerIncluded: core::ffi::c_int,
3785 pub limit: core::ffi::c_uint,
3786 pub scores: *mut PDScore,
3787}
3788#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3789const _: () = {
3790 ["Size of PDScoresList"][::core::mem::size_of::<PDScoresList>() - 32usize];
3791 ["Alignment of PDScoresList"][::core::mem::align_of::<PDScoresList>() - 8usize];
3792 ["Offset of field: PDScoresList::boardID"][::core::mem::offset_of!(PDScoresList, boardID) - 0usize];
3793 ["Offset of field: PDScoresList::count"][::core::mem::offset_of!(PDScoresList, count) - 8usize];
3794 ["Offset of field: PDScoresList::lastUpdated"][::core::mem::offset_of!(PDScoresList, lastUpdated) - 12usize];
3795 ["Offset of field: PDScoresList::playerIncluded"]
3796 [::core::mem::offset_of!(PDScoresList, playerIncluded) - 16usize];
3797 ["Offset of field: PDScoresList::limit"][::core::mem::offset_of!(PDScoresList, limit) - 20usize];
3798 ["Offset of field: PDScoresList::scores"][::core::mem::offset_of!(PDScoresList, scores) - 24usize];
3799};
3800impl Default for PDScoresList {
3801 fn default() -> Self {
3802 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3803 unsafe {
3804 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3805 s.assume_init()
3806 }
3807 }
3808}
3809#[repr(C)]
3810#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3811#[must_use]
3812pub struct PDBoard {
3813 pub boardID: *mut core::ffi::c_char,
3814 pub name: *mut core::ffi::c_char,
3815}
3816#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3817const _: () = {
3818 ["Size of PDBoard"][::core::mem::size_of::<PDBoard>() - 16usize];
3819 ["Alignment of PDBoard"][::core::mem::align_of::<PDBoard>() - 8usize];
3820 ["Offset of field: PDBoard::boardID"][::core::mem::offset_of!(PDBoard, boardID) - 0usize];
3821 ["Offset of field: PDBoard::name"][::core::mem::offset_of!(PDBoard, name) - 8usize];
3822};
3823impl Default for PDBoard {
3824 fn default() -> Self {
3825 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3826 unsafe {
3827 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3828 s.assume_init()
3829 }
3830 }
3831}
3832#[repr(C)]
3833#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3834#[must_use]
3835pub struct PDBoardsList {
3836 pub count: core::ffi::c_uint,
3837 pub lastUpdated: u32,
3838 pub boards: *mut PDBoard,
3839}
3840#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3841const _: () = {
3842 ["Size of PDBoardsList"][::core::mem::size_of::<PDBoardsList>() - 16usize];
3843 ["Alignment of PDBoardsList"][::core::mem::align_of::<PDBoardsList>() - 8usize];
3844 ["Offset of field: PDBoardsList::count"][::core::mem::offset_of!(PDBoardsList, count) - 0usize];
3845 ["Offset of field: PDBoardsList::lastUpdated"][::core::mem::offset_of!(PDBoardsList, lastUpdated) - 4usize];
3846 ["Offset of field: PDBoardsList::boards"][::core::mem::offset_of!(PDBoardsList, boards) - 8usize];
3847};
3848impl Default for PDBoardsList {
3849 fn default() -> Self {
3850 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3851 unsafe {
3852 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3853 s.assume_init()
3854 }
3855 }
3856}
3857pub type AddScoreCallback =
3858 ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore, errorMessage: *const core::ffi::c_char)>;
3859pub type PersonalBestCallback =
3860 ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore, errorMessage: *const core::ffi::c_char)>;
3861pub type BoardsListCallback =
3862 ::core::option::Option<unsafe extern "C" fn(boards: *mut PDBoardsList,
3863 errorMessage: *const core::ffi::c_char)>;
3864pub type ScoresCallback = ::core::option::Option<unsafe extern "C" fn(scores: *mut PDScoresList,
3865 errorMessage: *const core::ffi::c_char)>;
3866#[repr(C)]
3867#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3868#[must_use]
3869pub struct playdate_scoreboards {
3870 pub addScore: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3871 value: u32,
3872 callback: AddScoreCallback)
3873 -> core::ffi::c_int>,
3874 pub getPersonalBest: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3875 callback: PersonalBestCallback)
3876 -> core::ffi::c_int>,
3877 pub freeScore: ::core::option::Option<unsafe extern "C" fn(score: *mut PDScore)>,
3878 pub getScoreboards:
3879 ::core::option::Option<unsafe extern "C" fn(callback: BoardsListCallback) -> core::ffi::c_int>,
3880 pub freeBoardsList: ::core::option::Option<unsafe extern "C" fn(boardsList: *mut PDBoardsList)>,
3881 pub getScores: ::core::option::Option<unsafe extern "C" fn(boardId: *const core::ffi::c_char,
3882 callback: ScoresCallback)
3883 -> core::ffi::c_int>,
3884 pub freeScoresList: ::core::option::Option<unsafe extern "C" fn(scoresList: *mut PDScoresList)>,
3885}
3886#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3887const _: () = {
3888 ["Size of playdate_scoreboards"][::core::mem::size_of::<playdate_scoreboards>() - 56usize];
3889 ["Alignment of playdate_scoreboards"][::core::mem::align_of::<playdate_scoreboards>() - 8usize];
3890 ["Offset of field: playdate_scoreboards::addScore"]
3891 [::core::mem::offset_of!(playdate_scoreboards, addScore) - 0usize];
3892 ["Offset of field: playdate_scoreboards::getPersonalBest"]
3893 [::core::mem::offset_of!(playdate_scoreboards, getPersonalBest) - 8usize];
3894 ["Offset of field: playdate_scoreboards::freeScore"]
3895 [::core::mem::offset_of!(playdate_scoreboards, freeScore) - 16usize];
3896 ["Offset of field: playdate_scoreboards::getScoreboards"]
3897 [::core::mem::offset_of!(playdate_scoreboards, getScoreboards) - 24usize];
3898 ["Offset of field: playdate_scoreboards::freeBoardsList"]
3899 [::core::mem::offset_of!(playdate_scoreboards, freeBoardsList) - 32usize];
3900 ["Offset of field: playdate_scoreboards::getScores"]
3901 [::core::mem::offset_of!(playdate_scoreboards, getScores) - 40usize];
3902 ["Offset of field: playdate_scoreboards::freeScoresList"]
3903 [::core::mem::offset_of!(playdate_scoreboards, freeScoresList) - 48usize];
3904};
3905#[repr(C)]
3906#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3907#[must_use]
3908pub struct PlaydateAPI {
3909 pub system: *const playdate_sys,
3910 pub file: *const playdate_file,
3911 pub graphics: *const playdate_graphics,
3912 pub sprite: *const playdate_sprite,
3913 pub display: *const playdate_display,
3914 pub sound: *const playdate_sound,
3915 pub lua: *const playdate_lua,
3916 pub json: *const playdate_json,
3917 pub scoreboards: *const playdate_scoreboards,
3918}
3919#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3920const _: () = {
3921 ["Size of PlaydateAPI"][::core::mem::size_of::<PlaydateAPI>() - 72usize];
3922 ["Alignment of PlaydateAPI"][::core::mem::align_of::<PlaydateAPI>() - 8usize];
3923 ["Offset of field: PlaydateAPI::system"][::core::mem::offset_of!(PlaydateAPI, system) - 0usize];
3924 ["Offset of field: PlaydateAPI::file"][::core::mem::offset_of!(PlaydateAPI, file) - 8usize];
3925 ["Offset of field: PlaydateAPI::graphics"][::core::mem::offset_of!(PlaydateAPI, graphics) - 16usize];
3926 ["Offset of field: PlaydateAPI::sprite"][::core::mem::offset_of!(PlaydateAPI, sprite) - 24usize];
3927 ["Offset of field: PlaydateAPI::display"][::core::mem::offset_of!(PlaydateAPI, display) - 32usize];
3928 ["Offset of field: PlaydateAPI::sound"][::core::mem::offset_of!(PlaydateAPI, sound) - 40usize];
3929 ["Offset of field: PlaydateAPI::lua"][::core::mem::offset_of!(PlaydateAPI, lua) - 48usize];
3930 ["Offset of field: PlaydateAPI::json"][::core::mem::offset_of!(PlaydateAPI, json) - 56usize];
3931 ["Offset of field: PlaydateAPI::scoreboards"][::core::mem::offset_of!(PlaydateAPI, scoreboards) - 64usize];
3932};
3933impl Default for PlaydateAPI {
3934 fn default() -> Self {
3935 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3936 unsafe {
3937 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3938 s.assume_init()
3939 }
3940 }
3941}
3942#[repr(u32)]
3943#[must_use]
3944#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3945pub enum PDSystemEvent {
3946 kEventInit = 0,
3947 kEventInitLua = 1,
3948 kEventLock = 2,
3949 kEventUnlock = 3,
3950 kEventPause = 4,
3951 kEventResume = 5,
3952 kEventTerminate = 6,
3953 kEventKeyPressed = 7,
3954 kEventKeyReleased = 8,
3955 kEventLowPower = 9,
3956}
3957pub type __builtin_va_list = [__va_list_tag; 1usize];
3958#[repr(C)]
3959#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
3960#[must_use]
3961pub struct __va_list_tag {
3962 pub gp_offset: core::ffi::c_uint,
3963 pub fp_offset: core::ffi::c_uint,
3964 pub overflow_arg_area: *mut core::ffi::c_void,
3965 pub reg_save_area: *mut core::ffi::c_void,
3966}
3967#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3968const _: () = {
3969 ["Size of __va_list_tag"][::core::mem::size_of::<__va_list_tag>() - 24usize];
3970 ["Alignment of __va_list_tag"][::core::mem::align_of::<__va_list_tag>() - 8usize];
3971 ["Offset of field: __va_list_tag::gp_offset"][::core::mem::offset_of!(__va_list_tag, gp_offset) - 0usize];
3972 ["Offset of field: __va_list_tag::fp_offset"][::core::mem::offset_of!(__va_list_tag, fp_offset) - 4usize];
3973 ["Offset of field: __va_list_tag::overflow_arg_area"]
3974 [::core::mem::offset_of!(__va_list_tag, overflow_arg_area) - 8usize];
3975 ["Offset of field: __va_list_tag::reg_save_area"]
3976 [::core::mem::offset_of!(__va_list_tag, reg_save_area) - 16usize];
3977};
3978impl Default for __va_list_tag {
3979 fn default() -> Self {
3980 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
3981 unsafe {
3982 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3983 s.assume_init()
3984 }
3985 }
3986}