HoverRace  2.0
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HoverRace::Client::ClientApp Class Reference

Main game shell. More...

#include <ClientApp.h>

+ Inheritance diagram for HoverRace::Client::ClientApp:

Public Types

enum  ExitMode { ExitMode::QUITTING, ExitMode::SOFT_RESTART }
 
- Public Types inherited from HoverRace::Client::GameDirector
using sessionChangedSignal_t = boost::signals2::signal< void(std::shared_ptr< HoverScript::MetaSession >)>
 

Public Member Functions

 ClientApp ()
 
virtual ~ClientApp ()
 
Control::InputEventControllerGetController () const override
 
Display::DisplayGetDisplay () const override
 
SceneGetForegroundScene () const override
 Gets foreground scene, if available. More...
 
RosterGetParty () const override
 Retrieve the list of players connected to this game instance. More...
 
sessionChangedSignal_tGetSessionChangedSignal () override
 Access the signal that indicates that the gameplay session started or stopped. More...
 
VideoServices::VideoBufferGetVideoBuffer () const override
 
ExitMode MainLoop ()
 
Control::InputEventControllerReloadController () override
 Reload the control settings. More...
 
void RequestAnnouncement (std::shared_ptr< Announcement > ann) override
 Request an announcement to be displayed. More...
 
void RequestMainMenu (std::shared_ptr< LoadingScene > loadingScene=std::shared_ptr< LoadingScene >()) override
 Request a return to the main menu. More...
 
void RequestNewPracticeSession (std::shared_ptr< Rules > rules, std::shared_ptr< LoadingScene > loadingScene=std::shared_ptr< LoadingScene >()) override
 Request a new local practice session. More...
 
void RequestPopScene () override
 Return to the previous scene, if any. More...
 
void RequestPushScene (const std::shared_ptr< Scene > &scene) override
 Push a new scene to the foreground. More...
 
void RequestReplaceScene (const std::shared_ptr< Scene > &scene) override
 Replace the current scene and all background scenes with a new foreground scene. More...
 
void RequestShutdown () override
 Request an orderly shutdown the of app. More...
 
void RequestSoftRestart () override
 Request a restart of the app without restarting the whole process. More...
 
void RequestStatusPresentation () override
 Request that the status (logged-in players, etc.) be momentarily displayed to remind the user what's going on. More...
 
std::shared_ptr< Player::AvatarGalleryShareAvatarGallery () const override
 Retrieve the global avatar gallery. More...
 
std::shared_ptr< Player::PlayerShareUiPilot () const override
 Retrieve the current local player who is in control of the UI at the moment. More...
 
- Public Member Functions inherited from HoverRace::Client::GameDirector
virtual ~GameDirector ()
 

Private Types

using sceneStack_t = std::list< std::shared_ptr< Scene >>
 
using SUPER = GameDirector
 

Private Member Functions

void AdvanceScenes (Util::OS::timestamp_t tick)
 
std::string GetWindowTitle ()
 
void IncFrameCount ()
 Increment the frame counter for stats purposes. More...
 
void LoadInitialProfile ()
 Attempt to load the default profile to the roster. More...
 
void OnConsoleToggle ()
 
void OnWindowResize (int w, int h)
 Handle when the window is resized. More...
 
void PopScene ()
 Return to the previous scene, if any. More...
 
void PrepareScenes ()
 
void PushScene (const std::shared_ptr< Scene > &scene)
 Push a new scene to the foreground. More...
 
void RenderFrame ()
 
void RenderScenes ()
 
void ReplaceScene (const std::shared_ptr< Scene > &scene)
 Replace the current scene and all background scenes with a new foreground scene. More...
 
void SetForegroundScene ()
 Remove the foreground scene. More...
 
void SetForegroundScene (const std::shared_ptr< Scene > &iter)
 Switch which scene has input focus. More...
 
void TerminateAllScenes ()
 Immediately remove all scenes. More...
 

Private Attributes

std::shared_ptr< Util::ProfileradvanceProfiler
 
std::list< std::shared_ptr< Announcement > > announcements
 
std::shared_ptr< Player::AvatarGalleryavatarGallery
 
std::weak_ptr< HoverScript::ConsoleSceneconsoleScene
 
boost::signals2::connection consoleToggleConn
 
std::unique_ptr< Control::InputEventControllercontroller
 
std::unique_ptr< HoverScript::DebugPeerdebugPeer
 
std::unique_ptr< DebugScenedebugScene
 
std::unique_ptr< Display::Displaydisplay
 
std::shared_ptr< ScenefgScene
 The scene that currently has input focus. More...
 
double fps
 
std::unique_ptr< Display::ActiveTextfpsLbl
 
unsigned int frameCount
 
std::unique_ptr< HoverScript::GamePeergamePeer
 
std::unique_ptr< HoverScript::InputPeerinputPeer
 
Util::OS::timestamp_t lastTimestamp
 
bool needsDevWarning
 Display dev release warning on next menu. More...
 
bool needsLocaleCheck
 Check locale and warn on next menu. More...
 
std::unique_ptr< Rosterparty
 
std::shared_ptr< Util::ProfilerprepareProfiler
 
std::shared_ptr< Util::ProfilerrenderProfiler
 
std::shared_ptr< Util::ProfilerrootProfiler
 
std::unique_ptr< RulebookLibraryrulebookLibrary
 
sceneStack_t sceneStack
 
std::unique_ptr< Script::Corescripting
 
sessionChangedSignal_t sessionChangedSignal
 
const bool & showDebug
 
const bool & showFps
 
bool showOverlay
 
std::unique_ptr< StatusOverlayScenestatusOverlayScene
 
std::unique_ptr< HoverScript::SysConsolesysConsole
 
std::unique_ptr< HoverScript::SysEnvsysEnv
 
MR_UInt32 userEventId
 

Detailed Description

Main game shell.

Author
Michael Imamura

Member Typedef Documentation

using HoverRace::Client::ClientApp::sceneStack_t = std::list<std::shared_ptr<Scene>>
private

Member Enumeration Documentation

Enumerator
QUITTING 

Normal exit.

SOFT_RESTART 

Create and run a new ClientApp instance.

Constructor & Destructor Documentation

HoverRace::Client::ClientApp::ClientApp ( )
HoverRace::Client::ClientApp::~ClientApp ( )
virtual

Member Function Documentation

void HoverRace::Client::ClientApp::AdvanceScenes ( Util::OS::timestamp_t  tick)
private
Control::InputEventController* HoverRace::Client::ClientApp::GetController ( ) const
inlineoverridevirtual
Display::Display* HoverRace::Client::ClientApp::GetDisplay ( ) const
inlineoverridevirtual
Scene* HoverRace::Client::ClientApp::GetForegroundScene ( ) const
inlineoverridevirtual

Gets foreground scene, if available.

Returns
nullptr if no scene is active, else the foreground scene.

Implements HoverRace::Client::GameDirector.

Roster* HoverRace::Client::ClientApp::GetParty ( ) const
inlineoverridevirtual

Retrieve the list of players connected to this game instance.

Returns
The list (may be nullptr).

Implements HoverRace::Client::GameDirector.

sessionChangedSignal_t& HoverRace::Client::ClientApp::GetSessionChangedSignal ( )
inlineoverridevirtual

Access the signal that indicates that the gameplay session started or stopped.

Subscribers to this signal will get the ClientSession instance if the session is starting or nullptr if the session has ended.

Implements HoverRace::Client::GameDirector.

VideoServices::VideoBuffer * HoverRace::Client::ClientApp::GetVideoBuffer ( ) const
overridevirtual
std::string HoverRace::Client::ClientApp::GetWindowTitle ( )
private
void HoverRace::Client::ClientApp::IncFrameCount ( )
private

Increment the frame counter for stats purposes.

This should be called once per frame.

void HoverRace::Client::ClientApp::LoadInitialProfile ( )
private

Attempt to load the default profile to the roster.

ClientApp::ExitMode HoverRace::Client::ClientApp::MainLoop ( )
void HoverRace::Client::ClientApp::OnConsoleToggle ( )
private
void HoverRace::Client::ClientApp::OnWindowResize ( int  w,
int  h 
)
private

Handle when the window is resized.

Parameters
wThe new width.
hThe new height.
void HoverRace::Client::ClientApp::PopScene ( )
private

Return to the previous scene, if any.

Note
This must only be called from the main thread.
void HoverRace::Client::ClientApp::PrepareScenes ( )
private
void HoverRace::Client::ClientApp::PushScene ( const std::shared_ptr< Scene > &  scene)
private

Push a new scene to the foreground.

Note
This must only be called from the main thread.
Parameters
sceneThe scene to push.
Control::InputEventController * HoverRace::Client::ClientApp::ReloadController ( )
overridevirtual

Reload the control settings.

Returns
The new control settings.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RenderFrame ( )
private
void HoverRace::Client::ClientApp::RenderScenes ( )
private
void HoverRace::Client::ClientApp::ReplaceScene ( const std::shared_ptr< Scene > &  scene)
private

Replace the current scene and all background scenes with a new foreground scene.

Note
This must only be called from the main thread.
Parameters
sceneThe scene to push.
void HoverRace::Client::ClientApp::RequestAnnouncement ( std::shared_ptr< Announcement ann)
overridevirtual

Request an announcement to be displayed.

Note
This may be called from any thread.
Parameters
annThe announcement (may not be nullptr).

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestMainMenu ( std::shared_ptr< LoadingScene loadingScene = std::shared_ptr< LoadingScene >())
overridevirtual

Request a return to the main menu.

Parameters
loadingSceneOptional loading scene instead of default.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestNewPracticeSession ( std::shared_ptr< Rules rules,
std::shared_ptr< LoadingScene loadingScene = std::shared_ptr< LoadingScene >() 
)
overridevirtual

Request a new local practice session.

Parameters
rulesThe settings for the session.
loadingSceneOptional loading scene instead of default.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestPopScene ( )
overridevirtual

Return to the previous scene, if any.

Note
This may be called from any thread.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestPushScene ( const std::shared_ptr< Scene > &  scene)
overridevirtual

Push a new scene to the foreground.

Note
This may be called from any thread.
Parameters
sceneThe scene to push.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestReplaceScene ( const std::shared_ptr< Scene > &  scene)
overridevirtual

Replace the current scene and all background scenes with a new foreground scene.

Note
This may be called from any thread.
Parameters
sceneThe scene to push.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestShutdown ( )
overridevirtual

Request an orderly shutdown the of app.

This call returns immediately; the shutdown will actually occur later, possibly when you least expect it. All normal "Are you sure?" confirmation prompts will be skipped.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestSoftRestart ( )
overridevirtual

Request a restart of the app without restarting the whole process.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::RequestStatusPresentation ( )
overridevirtual

Request that the status (logged-in players, etc.) be momentarily displayed to remind the user what's going on.

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::SetForegroundScene ( )
private

Remove the foreground scene.

Note
This must only be called from the main thread. This indicates that there is no scene capable of receiving input.
void HoverRace::Client::ClientApp::SetForegroundScene ( const std::shared_ptr< Scene > &  scene)
private

Switch which scene has input focus.

Note
This must only be called from the main thread.
Parameters
sceneThe new foreground scene.
std::shared_ptr<Player::AvatarGallery> HoverRace::Client::ClientApp::ShareAvatarGallery ( ) const
inlineoverridevirtual

Retrieve the global avatar gallery.

Returns
The gallery (never nullptr).

Implements HoverRace::Client::GameDirector.

std::shared_ptr< Player::Player > HoverRace::Client::ClientApp::ShareUiPilot ( ) const
overridevirtual

Retrieve the current local player who is in control of the UI at the moment.

Returns
The player (may be nullptr if nobody has seized control).

Implements HoverRace::Client::GameDirector.

void HoverRace::Client::ClientApp::TerminateAllScenes ( )
private

Immediately remove all scenes.

Note
This must only be called from the main thread.

Member Data Documentation

std::shared_ptr<Util::Profiler> HoverRace::Client::ClientApp::advanceProfiler
private
std::list<std::shared_ptr<Announcement> > HoverRace::Client::ClientApp::announcements
private
std::shared_ptr<Player::AvatarGallery> HoverRace::Client::ClientApp::avatarGallery
private
std::weak_ptr<HoverScript::ConsoleScene> HoverRace::Client::ClientApp::consoleScene
private
boost::signals2::connection HoverRace::Client::ClientApp::consoleToggleConn
private
std::unique_ptr<Control::InputEventController> HoverRace::Client::ClientApp::controller
private
std::unique_ptr<HoverScript::DebugPeer> HoverRace::Client::ClientApp::debugPeer
private
std::unique_ptr<DebugScene> HoverRace::Client::ClientApp::debugScene
private
std::unique_ptr<Display::Display> HoverRace::Client::ClientApp::display
private
std::shared_ptr<Scene> HoverRace::Client::ClientApp::fgScene
private

The scene that currently has input focus.

double HoverRace::Client::ClientApp::fps
private
std::unique_ptr<Display::ActiveText> HoverRace::Client::ClientApp::fpsLbl
private
unsigned int HoverRace::Client::ClientApp::frameCount
private
std::unique_ptr<HoverScript::GamePeer> HoverRace::Client::ClientApp::gamePeer
private
std::unique_ptr<HoverScript::InputPeer> HoverRace::Client::ClientApp::inputPeer
private
Util::OS::timestamp_t HoverRace::Client::ClientApp::lastTimestamp
private
bool HoverRace::Client::ClientApp::needsDevWarning
private

Display dev release warning on next menu.

bool HoverRace::Client::ClientApp::needsLocaleCheck
private

Check locale and warn on next menu.

std::unique_ptr<Roster> HoverRace::Client::ClientApp::party
private
std::shared_ptr<Util::Profiler> HoverRace::Client::ClientApp::prepareProfiler
private
std::shared_ptr<Util::Profiler> HoverRace::Client::ClientApp::renderProfiler
private
std::shared_ptr<Util::Profiler> HoverRace::Client::ClientApp::rootProfiler
private
std::unique_ptr<RulebookLibrary> HoverRace::Client::ClientApp::rulebookLibrary
private
sceneStack_t HoverRace::Client::ClientApp::sceneStack
private
std::unique_ptr<Script::Core> HoverRace::Client::ClientApp::scripting
private
sessionChangedSignal_t HoverRace::Client::ClientApp::sessionChangedSignal
private
const bool& HoverRace::Client::ClientApp::showDebug
private
const bool& HoverRace::Client::ClientApp::showFps
private
bool HoverRace::Client::ClientApp::showOverlay
private
std::unique_ptr<StatusOverlayScene> HoverRace::Client::ClientApp::statusOverlayScene
private
std::unique_ptr<HoverScript::SysConsole> HoverRace::Client::ClientApp::sysConsole
private
std::unique_ptr<HoverScript::SysEnv> HoverRace::Client::ClientApp::sysEnv
private
MR_UInt32 HoverRace::Client::ClientApp::userEventId
private

The documentation for this class was generated from the following files: