Struct playdate_system::System
source · pub struct System<Api = Default>(/* private fields */);Implementations§
source§impl<Api: Api> System<Api>
impl<Api: Api> System<Api>
sourcepub fn set_update_callback<'u, U, F>(
&self,
on_update: F,
userdata: U
) -> Handler<'u, F, U>where
U: 'u,
F: 'u + FnMut(&mut U) -> bool,
pub fn set_update_callback<'u, U, F>( &self, on_update: F, userdata: U ) -> Handler<'u, F, U>where U: 'u, F: 'u + FnMut(&mut U) -> bool,
Takes any function and userdata,
registers callback in the system and
returns this function with userdata wrapped into the Handler with [Pin] inside.
For register a fn-ptr you could better use [set_update_callback_static].
Safety is ensured by Handler,
that resets the system registered update handler when drop.
sourcepub fn set_update_callback_boxed<'u, U, F>(&self, on_update: F, userdata: U)where
U: 'u,
F: 'u + FnMut(&mut U) -> bool,
pub fn set_update_callback_boxed<'u, U, F>(&self, on_update: F, userdata: U)where U: 'u, F: 'u + FnMut(&mut U) -> bool,
Consumes and leaks an any function with userdata into the Box,
registers callback in the system.
For register a fn-ptr you could better use [set_update_callback_static].
Safety is guaranteed by the caller.
See also System::set_update_callback, it prevents leaks and more safe.
sourcepub fn set_update_callback_static<U: 'static>(
&self,
on_update: Option<fn(userdata: &mut U) -> bool>,
userdata: U
)
pub fn set_update_callback_static<U: 'static>( &self, on_update: Option<fn(userdata: &mut U) -> bool>, userdata: U )
Consumes and leaks function on_update and userdata, wraps it into the Box,
then registers callback.
See also System::set_update_callback, it prevents leaks and more safe.
sourcepub fn set_update_handler<'t, U: 'static + Update>(
&'t self,
handler: Option<&'static mut U>
)where
&'t Api: Api,
pub fn set_update_handler<'t, U: 'static + Update>( &'t self, handler: Option<&'static mut U> )where &'t Api: Api,
Executes handler’s Update::set_update_handler_with with this inner api.
source§impl System<Default>
impl System<Default>
sourcepub fn Default() -> Self
pub fn Default() -> Self
Creates default System without type parameter requirement.
Uses ZST api::Default.
source§impl<Api: Api> System<Api>
impl<Api: Api> System<Api>
sourcepub fn language(&self) -> PDLanguage
pub fn language(&self) -> PDLanguage
Equivalent to sys::ffi::playdate_sys::getLanguage
sourcepub fn current_time_milliseconds(&self) -> Duration
pub fn current_time_milliseconds(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getCurrentTimeMilliseconds
sourcepub fn seconds_since_epoch(&self) -> Duration
pub fn seconds_since_epoch(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getSecondsSinceEpoch
sourcepub fn draw_fps(&self, x: c_int, y: c_int)
pub fn draw_fps(&self, x: c_int, y: c_int)
Equivalent to sys::ffi::playdate_sys::drawFPS
sourcepub fn flipped(&self) -> bool
pub fn flipped(&self) -> bool
Equivalent to sys::ffi::playdate_sys::getFlipped
sourcepub fn set_auto_lock_disabled(&self, disable: bool)
pub fn set_auto_lock_disabled(&self, disable: bool)
Equivalent to sys::ffi::playdate_sys::setAutoLockDisabled
sourcepub fn reduce_flashing(&self) -> bool
pub fn reduce_flashing(&self) -> bool
Equivalent to sys::ffi::playdate_sys::getReduceFlashing
sourcepub fn elapsed_time(&self) -> Duration
pub fn elapsed_time(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getElapsedTime
sourcepub fn reset_elapsed_time(&self)
pub fn reset_elapsed_time(&self)
Equivalent to sys::ffi::playdate_sys::resetElapsedTime
sourcepub fn battery_percentage(&self) -> c_float
pub fn battery_percentage(&self) -> c_float
Equivalent to sys::ffi::playdate_sys::getBatteryPercentage
sourcepub fn battery_voltage(&self) -> c_float
pub fn battery_voltage(&self) -> c_float
Equivalent to sys::ffi::playdate_sys::getBatteryVoltage
sourcepub fn timezone_offset(&self) -> i32
pub fn timezone_offset(&self) -> i32
Equivalent to sys::ffi::playdate_sys::getTimezoneOffset
sourcepub fn should_display_24_hour_time(&self) -> bool
pub fn should_display_24_hour_time(&self) -> bool
Equivalent to sys::ffi::playdate_sys::shouldDisplay24HourTime
sourcepub fn convert_epoch_to_date_time(&self, epoch: u32) -> PDDateTime
pub fn convert_epoch_to_date_time(&self, epoch: u32) -> PDDateTime
Equivalent to sys::ffi::playdate_sys::convertEpochToDateTime
sourcepub fn convert_epoch_to_date_time_to(&self, epoch: u32, dt: &mut PDDateTime)
pub fn convert_epoch_to_date_time_to(&self, epoch: u32, dt: &mut PDDateTime)
Equivalent to sys::ffi::playdate_sys::convertEpochToDateTime
sourcepub fn convert_date_time_to_epoch(&self, dt: &PDDateTime) -> u32
pub fn convert_date_time_to_epoch(&self, dt: &PDDateTime) -> u32
Equivalent to sys::ffi::playdate_sys::convertDateTimeToEpoch
Trait Implementations§
impl<Api: Copy> Copy for System<Api>
Auto Trait Implementations§
impl<Api> RefUnwindSafe for System<Api>where Api: RefUnwindSafe,
impl<Api> Send for System<Api>where Api: Send,
impl<Api> Sync for System<Api>where Api: Sync,
impl<Api> Unpin for System<Api>where Api: Unpin,
impl<Api> UnwindSafe for System<Api>where Api: UnwindSafe,
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: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.