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

source§

fn clone(&self) -> playdate_display

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for playdate_display

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for playdate_display

source§

fn default() -> playdate_display

Returns the “default value” for a type. Read more
source§

impl Hash for playdate_display

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given [Hasher]. Read more
source§

impl Ord for playdate_display

source§

fn cmp(&self, other: &playdate_display) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for playdate_display

source§

fn eq(&self, other: &playdate_display) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for playdate_display

source§

fn partial_cmp(&self, other: &playdate_display) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for playdate_display

source§

impl Eq for playdate_display

source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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