pub struct Playdate<S: Sdk> { /* private fields */ }Expand description
The Playdate’s Platform.
Implementations§
Source§impl<S: Sdk> Playdate<S>
impl<S: Sdk> Playdate<S>
Sourcepub fn start<G: GameData>(&mut self, game: &Game<G>)
pub fn start<G: GameData>(&mut self, game: &Game<G>)
The game has loaded: loads its sounds, reads the crank’s notch from its keymap, adds the system menu’s items its optional actions are bound to, and lets it hear of the crank from the next frame.
The player chose the system menu’s item in slot: a press of its
button at the next poll, so it goes where input goes.
Sourcepub fn event(&mut self, event: SdkEvent) -> bool
pub fn event(&mut self, event: SdkEvent) -> bool
The SDK’s event, as the SystemEvents the next frame reads. True
when it should be heard now: no update comes until the system gives
the game back, so what it saves must be saved before.
Sourcepub fn take_changed(&mut self) -> bool
pub fn take_changed(&mut self) -> bool
Whether anything reached the screen since the last call: the update callback returns it.
Trait Implementations§
Source§impl<S: Sdk> Platform for Playdate<S>
impl<S: Sdk> Platform for Playdate<S>
Source§fn display(&self) -> DisplayInfo
fn display(&self) -> DisplayInfo
The display, as it is now (a window may be resized between frames).
Source§fn present(&mut self, frame: &Frame<'_>)
fn present(&mut self, frame: &Frame<'_>)
Shows
frame. Called once per frame the game isn’t suspended,
after its input, audio and update; the backend shows it as soon
as it can and keeps it on the screen until the next.Source§fn poll_input(&mut self, out: &mut Vec<RawInputEvent>)
fn poll_input(&mut self, out: &mut Vec<RawInputEvent>)
Adds the keyboard and controller events since the last call to
out, in the order they happened: releases before presses within
one poll of a device, as RawInputEvent::from_pads gives them.Source§fn system_events(&mut self, out: &mut Vec<SystemEvent>)
fn system_events(&mut self, out: &mut Vec<SystemEvent>)
Adds the system’s events since the last call to
out, in order.Source§fn storage(&mut self) -> Box<dyn Storage>
fn storage(&mut self) -> Box<dyn Storage>
Hands over the game’s storage: its saves, settings and key bindings,
by key.
App calls it once, as the game loads, and the game’s
context keeps it (screens save through it).Source§fn audio(&mut self) -> &mut dyn Audio
fn audio(&mut self) -> &mut dyn Audio
The sound device: it plays each frame’s sounds, music and voices
and says what music is sounding.
Source§fn text_input(&mut self) -> Option<&mut dyn TextInput>
fn text_input(&mut self) -> Option<&mut dyn TextInput>
The system’s own keyboard for text (a console’s, Steam’s on-screen
one), if the device has one;
None where the player types on keys,
which come through poll_input.Source§fn facts(&self) -> PlatformFacts
fn facts(&self) -> PlatformFacts
Where the game runs (
PlatformFacts): the target’s id, whether
the game may quit, whether its window goes full screen and back,
and the keyboard, pointer and touch screen the device has. Read
from the target’s profile, or from what the backend reads of the
system; constant for a run. App asks once, as the game loads, and
the game’s context keeps them (Ctx::platform). Read moreSource§fn clock(&self) -> Option<PerfClock>
fn clock(&self) -> Option<PerfClock>
A clock in whole microseconds, to measure frames with in debug
builds (ADR-0046):
App takes it once, on its first frame, and only
with DEBUG_TOOLS on. None (the
default) for a backend without one: nothing is measured.Source§fn memory(&mut self) -> Option<MemoryReading>
fn memory(&mut self) -> Option<MemoryReading>
The device’s memory now, in debug builds (ADR-0046): the heap’s
live bytes, their peak and the allocations since the last call.
App asks once a frame, at the end of a frame it keeps a record of
(debug tools on, with a clock), and puts the heap’s counts in the
record. None (the default) for a backend that doesn’t count:
records have no heap counts.Source§fn memory_scopes(&self) -> Option<MemoryScopes>
fn memory_scopes(&self) -> Option<MemoryScopes>
The memory tags of the backend’s heap counter, in debug builds
(ADR-0046 §6): plain functions over its tags, so what the game
allocates counts by the frame’s phase and the game’s spans.
App
takes them with the clock (clock), once, with
DEBUG_TOOLS on, and moves them into the
game’s context when it runs. None (the default) for a backend
whose counter has no tags. A backend with them also tags each
asset decode when it starts, before the game’s load
(shuyi_assets::format::watch_decodes).Source§fn heap_snapshot(&mut self) -> Option<HeapSnapshot>
fn heap_snapshot(&mut self) -> Option<HeapSnapshot>
What holds the heap now, by memory tag, in debug builds (ADR-0046
§6): its live bytes and each tag’s counts, its
frame left 0 for
App::heap_snapshot to stamp. Taking
one allocates the rows, so it is asked for now and then (a tool, a
trace every 600 frames), never every frame. None (the default)
for a backend whose counter has no tags.Source§fn changed_files(&mut self, _out: &mut Vec<String>)
fn changed_files(&mut self, _out: &mut Vec<String>)
Adds the paths in the bundle of the files that changed since the
last call to
out, in a build with debug tools (ADR-0071): the
backend has already put their new bytes in their layers
(Layer::replace). App asks
once a frame while the game runs, only with
Ctx::debug_tools on. By default it
adds nothing: a device with no files to watch.Auto Trait Implementations§
impl<S> !Freeze for Playdate<S>
impl<S> !RefUnwindSafe for Playdate<S>
impl<S> !Send for Playdate<S>
impl<S> !Sync for Playdate<S>
impl<S> !UnwindSafe for Playdate<S>
impl<S> Unpin for Playdate<S>where
S: Unpin,
<S as Sdk>::Sample: Unpin,
<S as Sdk>::SamplePlayer: Unpin,
<S as Sdk>::FilePlayer: Unpin,
impl<S> UnsafeUnpin for Playdate<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more