Struct playdate_sys::ffi::playdate_display
source · #[repr(C)]pub struct playdate_display {
pub getWidth: Option<unsafe extern "C" fn() -> c_int>,
pub getHeight: Option<unsafe extern "C" fn() -> c_int>,
pub setRefreshRate: Option<unsafe extern "C" fn(rate: c_float)>,
pub setInverted: Option<unsafe extern "C" fn(flag: c_int)>,
pub setScale: Option<unsafe extern "C" fn(s: c_uint)>,
pub setMosaic: Option<unsafe extern "C" fn(x: c_uint, y: c_uint)>,
pub setFlipped: Option<unsafe extern "C" fn(x: c_int, y: c_int)>,
pub setOffset: Option<unsafe extern "C" fn(x: c_int, y: c_int)>,
}
Fields§
§getWidth: Option<unsafe extern "C" fn() -> c_int>
int playdate->display->getWidth(void)
Returns 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.
Equivalent to playdate.display.getWidth()
in the Lua API.
getHeight: Option<unsafe extern "C" fn() -> c_int>
int playdate->display->getHeight(void)
Returns 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.
Equivalent to playdate.display.getHeight()
in the Lua API.
setRefreshRate: Option<unsafe extern "C" fn(rate: c_float)>
void playdate->display->setRefreshRate(float rate)
Sets 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.
If rate is 0, the game’s update callback (either Lua’s playdate.update()
or the function specified by playdate→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.
Equivalent to playdate.display.setRefreshRate()
in the Lua API.
setInverted: Option<unsafe extern "C" fn(flag: c_int)>
void playdate->display->setInverted(int flag)
If flag evaluates to true, the frame buffer is drawn inverted—black instead of white, and vice versa.
Equivalent to playdate.display.setInverted()
in the Lua API.
setScale: Option<unsafe extern "C" fn(s: c_uint)>
void playdate->display->setScale(unsigned int s)
Sets the display scale factor. Valid values for scale are 1, 2, 4, and 8.
The 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.
Equivalent to playdate.display.setScale()
in the Lua API.
setMosaic: Option<unsafe extern "C" fn(x: c_uint, y: c_uint)>
void playdate->display->setMosaic(unsigned int x, unsigned int y)
Adds a mosaic effect to the display. Valid x and y values are between 0 and 3, inclusive.
Equivalent to playdate.display.setMosaic
in the Lua API.
setFlipped: Option<unsafe extern "C" fn(x: c_int, y: c_int)>
void playdate->display->setFlipped(int x, int y)
Flips the display on the x or y axis, or both.
Equivalent to playdate.display.setFlipped()
in the Lua API.
setOffset: Option<unsafe extern "C" fn(x: c_int, y: c_int)>
void playdate->display->setOffset(int dx, int dy)
Offsets the display by the given amount. Areas outside of the displayed area are filled with the current background color.
Equivalent to playdate.display.setOffset()
in the Lua API.
Trait Implementations§
source§impl Clone for playdate_display
impl Clone for playdate_display
source§fn clone(&self) -> playdate_display
fn clone(&self) -> playdate_display
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for playdate_display
impl Debug for playdate_display
source§impl Default for playdate_display
impl Default for playdate_display
source§fn default() -> playdate_display
fn default() -> playdate_display
source§impl Hash for playdate_display
impl Hash for playdate_display
source§impl Ord for playdate_display
impl Ord for playdate_display
source§impl PartialEq for playdate_display
impl PartialEq for playdate_display
source§fn eq(&self, other: &playdate_display) -> bool
fn eq(&self, other: &playdate_display) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for playdate_display
impl PartialOrd for playdate_display
impl Copy for playdate_display
impl Eq for playdate_display
impl StructuralPartialEq for playdate_display
Auto Trait Implementations§
impl Freeze for playdate_display
impl RefUnwindSafe for playdate_display
impl Send for playdate_display
impl Sync for playdate_display
impl Unpin for playdate_display
impl UnwindSafe for playdate_display
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes