Display

Struct Display 

Source
pub struct Display<Api = Default>(/* private fields */);

Implementations§

Source§

impl Display<Default>

Source

pub fn Default() -> Self

Creates default Display without type parameter requirement.

Uses ZST api::Default.

Source§

impl Display<Cache>

Source

pub fn Cached() -> Self

Creates Display without type parameter requirement.

Uses api::Cache.

Source§

impl<Api: Default + Api> Display<Api>

Source

pub fn new() -> Self

Source§

impl<Api: Api> Display<Api>

Source

pub fn new_with(api: Api) -> Self

Source§

impl Display<Default>

Source

pub const COLUMNS: u32 = 400u32

Source

pub const ROWS: u32 = 240u32

Source

pub const ROW_SIZE: u32 = 52u32

Source

pub const SCREEN_RECT: LCDRect

Source§

impl<Api: Api> Display<Api>

Source

pub fn width(&self) -> c_int

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.

See also Display::COLUMNS.

Equivalent to sys::ffi::playdate_display::getWidth

Source

pub fn height(&self) -> c_int

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.

See also Display::ROWS and Display::ROW_SIZE.

Equivalent to sys::ffi::playdate_display::getHeight

Source

pub fn set_refresh_rate(&self, rate: c_float)

Sets the nominal refresh rate in frames per second.

Default is 20 fps, the maximum rate supported by the hardware for full-frame updates.

Equivalent to sys::ffi::playdate_display::setRefreshRate

Source

pub fn set_inverted(&self, value: bool)

If value is true, the frame buffer is drawn inverted—black instead of white, and vice versa.

Equivalent to sys::ffi::playdate_display::setInverted

Source

pub fn set_scale(&self, scale: DisplayScale)

Sets the display scale factor.

The top-left corner of the frame buffer is scaled up to fill the display;

e.g., if the scale is set to DisplayScale::Quad, the pixels in rectangle [0, 100] x [0, 60] are drawn on the screen as 4 x 4 squares.

Equivalent to sys::ffi::playdate_display::setScale

Source

pub fn set_scale_raw(&self, scale: c_uint)

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.

See also Display::set_scale.

Equivalent to sys::ffi::playdate_display::setScale

Source

pub fn set_mosaic(&self, x: c_uint, y: c_uint)

Adds a mosaic effect to the display.

Valid x and y values are between 0 and 3, inclusive.

Equivalent to sys::ffi::playdate_display::setMosaic

Source

pub fn set_flipped(&self, x: bool, y: bool)

Flips the display on the x or y axis, or both.

Equivalent to sys::ffi::playdate_display::setFlipped

Source

pub fn set_offset(&self, x: c_int, y: c_int)

Offsets the display by the given amount.

Areas outside of the displayed area are filled with the current background color.

See also [playdate-graphics::set_background_color].

Equivalent to sys::ffi::playdate_display::setOffset

Trait Implementations§

Source§

impl<Api: Clone> Clone for Display<Api>

Source§

fn clone(&self) -> Display<Api>

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<Api: Debug> Debug for Display<Api>

Source§

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

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

impl<Api: Default + Api> Default for Display<Api>

Source§

fn default() -> Self

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

impl<Api: Copy> Copy for Display<Api>

Auto Trait Implementations§

§

impl<Api> Freeze for Display<Api>
where Api: Freeze,

§

impl<Api> RefUnwindSafe for Display<Api>
where Api: RefUnwindSafe,

§

impl<Api> Send for Display<Api>
where Api: Send,

§

impl<Api> Sync for Display<Api>
where Api: Sync,

§

impl<Api> Unpin for Display<Api>
where Api: Unpin,

§

impl<Api> UnwindSafe for Display<Api>
where Api: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.