What a display package implements: setup, presenting frames, events and UI overlays.
More...
|
| virtual | ~IDisplay ()=default |
| virtual void | ClearActiveUIOverlay ()=0 |
| virtual void * | CreateUIOverlay (int32_t width, int32_t height)=0 |
| virtual void | DestroyUIOverlay (void *overlay)=0 |
| virtual ColorFormat | GetColorFormat () const =0 |
| | The pixel format this display takes.
|
| virtual void | GetDisplaySize (int32_t *width, int32_t *height) const =0 |
| virtual bool | GetFramesShown (uint64_t *frames, uint64_t *lastShownUs) const |
| | How many frames the panel has shown so far, and when the latest one went up (microseconds on the display's own monotonic clock), for a frame-rate counter: frames shown over the time between two readings is the rate the player sees, which timing the game's loop is not (the loop may run a frame ahead and its frames take uneven times).
|
| virtual uint32_t | GetRefreshPeriodUs () const |
| | Microseconds between the panel's refreshes when each frame waits for one, so it is shown whole; 0 when frames are shown as they come.
|
| virtual uint8_t * | GetRenderBuffer (int32_t *width, int32_t *height) |
| | A buffer the display owns that the renderer can draw into directly, such as a DMA-capable buffer in fast internal RAM, saving a copy in Present.
|
| virtual bool | Initialize (int32_t width, int32_t height)=0 |
| virtual bool | IsInitialized () const =0 |
| virtual void | Present (const uint8_t *framebuffer, int width, int height, ColorFormat format)=0 |
| | Shows the whole framebuffer.
|
| virtual void | PresentRegions (const uint8_t *framebuffer, int width, int height, ColorFormat format, const Rect *rects, int32_t count) |
| | Shows only rects of the framebuffer: framebuffer pixels, half-open, already clipped, possibly overlapping.
|
| virtual bool | ProcessEvents ()=0 |
| | Handles platform events (window close, resize, ...).
|
| virtual void | RequestFullRefresh ()=0 |
| | Makes the next present redraw the whole screen.
|
| virtual void | SetActiveUIOverlay (void *overlay)=0 |
| virtual void | SetBacklight (bool on) |
| | Turns the backlight on or off.
|
| virtual void | SetRefreshesPerFrame (uint32_t refreshes) |
| | How many refreshes each frame stays on screen: 1 at the panel's rate, 2 at half of it.
|
| virtual void | Shutdown ()=0 |
| virtual bool | SupportsPartialPresent () const |
| | True when PresentRegions() sends only the rectangles it is given.
|
| virtual bool | UpdateUIOverlay (void *overlay, int32_t x, int32_t y, int32_t width, int32_t height, const uint32_t *pixels)=0 |
| virtual bool | UpdateUIOverlayRGB565A8 (void *overlay, int32_t x, int32_t y, int32_t width, int32_t height, const uint8_t *rgb565a8Pixels)=0 |
What a display package implements: setup, presenting frames, events and UI overlays.
The platform package loaded at runtime registers its display with Engine::SetDisplay(this, name); the engine holds only the pointer.
| virtual bool Deki::IDisplay::GetFramesShown |
( |
uint64_t * | frames, |
|
|
uint64_t * | lastShownUs ) const |
|
inlinevirtual |
How many frames the panel has shown so far, and when the latest one went up (microseconds on the display's own monotonic clock), for a frame-rate counter: frames shown over the time between two readings is the rate the player sees, which timing the game's loop is not (the loop may run a frame ahead and its frames take uneven times).
False from a display that does not see its frames go up; a counter then has only the loop to time, and should say so.
| virtual uint32_t Deki::IDisplay::GetRefreshPeriodUs |
( |
| ) |
const |
|
inlinevirtual |
Microseconds between the panel's refreshes when each frame waits for one, so it is shown whole; 0 when frames are shown as they come.
The main loop then times frames to a whole number of refreshes: a game clock a little off the panel's (60.0 frames a second on a 60.2 Hz panel) would show a frame twice every few seconds, a stutter. Each frame also moves the game on by its whole number of refreshes, not the time the loop measured, so motion steps exactly with the panel.
| virtual void Deki::IDisplay::PresentRegions |
( |
const uint8_t * | framebuffer, |
|
|
int | width, |
|
|
int | height, |
|
|
ColorFormat | format, |
|
|
const Rect * | rects, |
|
|
int32_t | count ) |
|
inlinevirtual |
Shows only rects of the framebuffer: framebuffer pixels, half-open, already clipped, possibly overlapping.
count 0 means nothing changed since the last present: a windowed display still redraws its window from the texture it holds, an LCD does nothing. The default sends the whole frame.
| virtual void Deki::IDisplay::SetRefreshesPerFrame |
( |
uint32_t | refreshes | ) |
|
|
inlinevirtual |
How many refreshes each frame stays on screen: 1 at the panel's rate, 2 at half of it.
The main loop sets it from the target frame rate, for a display that reports its refresh period. A display that shows frames on its own thread holds each one that long, so a frame finished a little early is not shown early and then followed by a long one, which is judder at a steady average. The default ignores it.