|
ReXGlue SDK
|
#include <rex/app/app.h>
Public Member Functions | |
| REX_SETTING (std::string, name, "", "App name, set by the constructor", kStartupOnly, kNoSave) | |
| REX_SETTING (std::filesystem::path, root, "", "Folder the app keeps its files in, the folder of the executable when empty", kStartupOnly) | |
| REX_SETTING (std::filesystem::path, log_root, "{app.root}/logs", "Log folder", kStartupOnly) | |
| REX_SETTING (std::string, single_instance, "", "Lock name only one running copy may hold, empty for none", kStartupOnly) | |
| App (std::string_view name) | |
| App (const App &)=delete | |
| App & | operator= (const App &)=delete |
| std::string_view | GetName () const |
| AppPhase | GetPhase () const |
| std::span< const std::string > | GetArgs () const |
| rex::hid::IInputSystem & | GetInput () |
| rex::gpu::IGraphicsSystem & | GetGraphics () |
| rex::apu::IAudioSystem & | GetAudio () |
| rex::ui::IUISystem & | GetUI () |
| void | RequestShutdown () |
| void | RequestRestart () |
| Result< void > | Init (const CLIArgList &args) |
| bool | RunFrame () |
| void | Run () |
| int | Shutdown () |
| Public Member Functions inherited from rex::SettingOwner | |
| SettingOwner (std::string_view scope) | |
| virtual | ~SettingOwner () |
| const std::string & | GetScope () const |
| std::span< SettingBase *const > | GetOwnedSettings () const |
Protected Member Functions | |
| virtual AppSysRequirements | GetRequirements () const |
| virtual Result< void > | OnConfigure (SettingsRegistry &settings) |
| virtual std::span< const CLIAction > | GetActions () const |
| virtual Result< void > | OnAction (const CLIActionHit &hit) |
| virtual void | OnModules (std::vector< std::string > &modules) |
| virtual void | OnRegisterModules (std::vector< IModule * > &modules) |
| virtual Result< void > | OnInit () |
| virtual void | OnRun () |
| virtual void | OnShutdown () |
| virtual void | ReportError (std::string_view message) |
| virtual platform::CrashReporterOptions | GetCrashOptions () |
| rex::ui::IUISystem * | FindUI () |
| bool | IsHeadlessRequested () const |
| Result< void > | Fail (std::string_view step, Error error) |
| virtual void | OnStop () |
| virtual void | OnRelease () |
| IInterfaceFactory & | GetControlFactory () |
| void | SetPhase (AppPhase phase) |
| Protected Member Functions inherited from rex::NonCopyable | |
| NonCopyable (const NonCopyable &)=delete | |
| NonCopyable & | operator= (const NonCopyable &)=delete |
A program derives from it, overrides the hooks it needs and hands the class to REX_TITLE_APP or REX_CONSOLE_APP. It owns the app.* path settings.
|
explicit |
| name | The app name, which names the config file and the log file. |
Marks a failed lifecycle step so Shutdown returns 1, and reports it.
| step | Name of the step, used in the report. |
|
protected |
Returns the UI system, or null while the systems are not connected and after a failed start released them.
|
protectedvirtual |
Returns the command line actions this program accepts, such as –version. The default has none.
| std::span< const std::string > rex::app::App::GetArgs | ( | ) | const |
Returns the positional command line arguments the framework did not consume.
|
protected |
Returns the internal interfaces of the systems, for TitleRuntime::Launch.
|
protectedvirtual |
The base class names the app after the executable and shows no dialog.
Reimplemented in rex::app::TitleApp.
| rex::hid::IInputSystem & rex::app::App::GetInput | ( | ) |
Returns the input system. Its settings register in Init and it starts with the modules.
|
protectedvirtual |
Returns the systems this program needs. The app uses it to choose driver plugins and to fail startup when a required system has no driver. The default requires nothing.
Reimplemented in rex::app::TitleApp.
|
nodiscard |
The start and modules phases. Ends with OnInit.
A shutdown or restart requested in OnConfigure or in OnAction ends startup once the log file is open, before the crash reporter and before any driver module loads. OnInit does not run, Init returns Ok and logs no error, and the caller goes on to Shutdown. A caller that runs Init itself tells the two outcomes apart with rex::app::IsShutdownRequested.
|
protected |
Reports whether the program asked for no UI driver, in any layer or on the command line. The answer holds after the UI system is gone.
|
nodiscardprotectedvirtual |
Init, after the command line is read, once for each action given. A shutdown or restart requested here ends startup once the log file is open, before any driver module loads.
| hit | The action and the text given with it. |
|
nodiscardprotectedvirtual |
Init, after the modules connect and before the config file, environment and command line apply. Set title layer values and register the program's own setting owners here. A shutdown or restart requested here ends startup before any driver module loads.
|
nodiscardprotectedvirtual |
Init, last. The systems run and the window is open. Add fonts, styles and overlays here.
|
protectedvirtual |
Init, before any module loads. Edits the module libraries rex::Init loads, in order. The default is rexfilesystem, rexhid, rexapu, rexui, rexgpu, rexxam, rexxbdm and rexkernel.
| modules | The library names. The driver plugins load after them. |
|
protectedvirtual |
Init, before modules connect. Register modules compiled into the program here.
| modules | Where to add them. The app does not own them. |
|
protectedvirtual |
Releases what a derived app type created after Init. Runs after OnShutdown.
Reimplemented in rex::app::TitleApp.
|
protectedvirtual |
The default calls RunFrame until a shutdown is requested.
Reimplemented in rex::app::TitleApp.
|
protectedvirtual |
Shutdown, before drivers shut down. Logging and settings work.
|
protectedvirtual |
Stops what a derived app type runs. Shutdown calls it first, before OnShutdown.
Reimplemented in rex::app::TitleApp.
|
protectedvirtual |
Reports an error from a lifecycle step. The base class logs it.
Reimplemented in rex::app::TitleApp.
| void rex::app::App::RequestRestart | ( | ) |
Asks the app to shut down and start the process again with the same arguments, so kRestart settings take effect. Any thread.
| void rex::app::App::RequestShutdown | ( | ) |
Asks the app to shut down, stopping a running title first. Any thread.
| void rex::app::App::Run | ( | ) |
The running phase. Calls OnRun.
| bool rex::app::App::RunFrame | ( | ) |
Runs one frame of the running phase, delivering window events and the work posted to the UI thread.
|
protected |
Moves the app to a phase between kRunning and kTitleStop, for an app that runs a title.
| int rex::app::App::Shutdown | ( | ) |
The shutdown phase. Safe after a failed Init.