Composition root for a platform. More...
#include <Platform.h>
Public Member Functions | |
| virtual void | init (const PlatformConfig &config)=0 |
| Constructs and initializes all five drivers for this platform. | |
| const PlatformConfig & | getConfig () const |
| The PlatformConfig this platform was init()'d with. | |
| virtual void | requestExit ()=0 |
| Tears down the platform (via shutdown()) and then performs whatever platform-appropriate action actually ends the app - return to loader/menu, power off, or just exit(), depending on how getSystemEvent() last reported and how the platform was reached. | |
| virtual AudioDriver * | getAudio ()=0 |
| virtual VideoDriver * | getVideo ()=0 |
| virtual InputDriver * | getInput ()=0 |
| virtual FileSystemDriver * | getFileSystem ()=0 |
| virtual ThreadDriver * | getThread ()=0 |
| virtual Logger * | getLogger ()=0 |
| May return nullptr on a Platform that hasn't finished init() yet - LogPrintf()/LOG_*() already guard against this, but code calling platform->getLogger() directly should too. | |
| virtual SystemEvent | getSystemEvent ()=0 |
| Current hardware/OS-level system event, if any. | |
| virtual Status | getStatus () const =0 |
| Current platform lifecycle state (Running, Paused, Exiting). | |
| virtual void | triggerExit ()=0 |
| Transitions platform state to move to Exiting. | |
| bool | shouldExit () |
| True once triggerExit() has been called, or the platform's own getSystemEvent() independently reports ShutdownRequested (eg. | |
Protected Member Functions | |
| virtual void | shutdown ()=0 |
| Shuts down and releases all five drivers. | |
Protected Attributes | |
| PlatformConfig | config {} |
| Set by init() in every concrete Platform - store the passed-in config as the very first line of the override. | |
Composition root for a platform.
Owns the five concrete drivers below and is the only place app code needs an #ifdef to pick a platform - everything else goes through the abstract driver interfaces.
Definition at line 65 of file Platform.h.
|
pure virtual |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
inline |
The PlatformConfig this platform was init()'d with.
Definition at line 74 of file Platform.h.
|
pure virtual |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
May return nullptr on a Platform that hasn't finished init() yet - LogPrintf()/LOG_*() already guard against this, but code calling platform->getLogger() directly should too.
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Current platform lifecycle state (Running, Paused, Exiting).
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Current hardware/OS-level system event, if any.
A single query rather than independent shutdown/reset flags.
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Constructs and initializes all five drivers for this platform.
| config | GUI canvas size and asset scale for this platform |
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Tears down the platform (via shutdown()) and then performs whatever platform-appropriate action actually ends the app - return to loader/menu, power off, or just exit(), depending on how getSystemEvent() last reported and how the platform was reached.
It does not return.
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
inline |
True once triggerExit() has been called, or the platform's own getSystemEvent() independently reports ShutdownRequested (eg.
a hardware power button). Not every platform folds Status::Exiting into its getSystemEvent() report - GameCube has no hardware event source and always reports None, relying entirely on triggerExit() - so callers wanting to leave promptly on either signal should check this rather than either alone.
Definition at line 112 of file Platform.h.
|
protectedpure virtual |
Shuts down and releases all five drivers.
Any background Thread that might still call into a driver must be stopped and joined (eg. via Thread::JoinAll()) before calling this, since the drivers it deletes may be in active use.
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
pure virtual |
Transitions platform state to move to Exiting.
Implemented in GameCubePlatform, WiiPlatform, and WutPlatform.
|
protected |
Set by init() in every concrete Platform - store the passed-in config as the very first line of the override.
Definition at line 117 of file Platform.h.