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

Base for scenes that render and interact with tracks. More...

#include <GameScene.h>

+ Inheritance diagram for HoverRace::Client::GameScene:

Classes

struct  Viewport
 

Public Member Functions

 GameScene (const std::string &name, Display::Display &display, GameDirector &director, Script::Core &scripting, std::shared_ptr< Rules > rules, std::shared_ptr< Util::Loader > loader)
 
virtual ~GameScene ()
 
void Advance (Util::OS::timestamp_t tick) override
 
bool IsMouseCursorEnabled () const override
 Determine if the mouse cursor is enabled for this scene. More...
 
void Layout () override
 Adjust the size and position of any child elements. More...
 
std::ostream & OutputDebugText (std::ostream &oss) const override
 Output a stream of debug information describing this scene. More...
 
void PrepareRender () override
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::UiScene
 UiScene (const std::string &name="")
 
virtual ~UiScene ()
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. More...
 
void DetachController (Control::InputEventController &, ConnList &) override
 Remove the controller mappings. More...
 
bool IsMouseCursorEnabled () const override
 Determine if the mouse cursor is enabled for this scene. More...
 
void PrepareRender () override
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::Scene
 Scene (const std::string &name="Unnamed Scene")
 Constructor. More...
 
virtual ~Scene ()
 
void AdvanceScene (Util::OS::timestamp_t tick)
 
void AttachInput (Control::InputEventController &controller)
 Attach the user input to the scene. More...
 
void DetachInput (Control::InputEventController &controller)
 Detach the user input from the scene. More...
 
const std::string & GetName () const
 Retrieve the name of the scene. More...
 
Phase GetPhase () const
 
State GetState () const
 
bool MoveToBackground ()
 Signal that the scene is moving into the background. More...
 
bool MoveToForeground ()
 Signal that the scene is moving into the foreground. More...
 
virtual void OnScenePushed ()
 Called when the scene is actually pushed to the stage. More...
 
Sceneoperator= (const Scene &)=delete
 
void PrepareScene ()
 
void RenderScene ()
 
bool SetPhase (Phase phase)
 Switch to another phase. More...
 

Protected Member Functions

virtual void OnFinishedLoading ()
 
void SetHudVisible (bool visible)
 
void SetMuted (bool muted)
 
- Protected Member Functions inherited from HoverRace::Client::UiScene
void RequestLayout ()
 Indicate that the current layout is out-of-date and needs to be adjusted. More...
 
void SetFocusRoot (std::shared_ptr< Display::UiViewModel > root)
 Set the widget used as the root for all focus management. More...
 
- Protected Member Functions inherited from HoverRace::Client::Scene
Util::OS::timestamp_t GetPhaseDuration (Util::OS::timestamp_t curTime=Util::OS::Time())
 Calculate how much time we've spent in the current phase. More...
 
Util::OS::timestamp_t GetStartingPhaseTime ()
 Return how long the starting phase lasted. More...
 
Util::OS::timestamp_t GetStateDuration (Util::OS::timestamp_t curTime=Util::OS::Time())
 Calculate how much time we've spent in the current state. More...
 
virtual void OnPhaseChanged (Phase oldPhase)
 Fired immediately after entering a new phase. More...
 
virtual void OnPhaseTransition (double progress)
 Fired during the starting and stopping phases, if SetPhaseTransitionDuration() was set. More...
 
virtual void OnStateChanged (State oldState)
 Fired immediately after entering a new state. More...
 
virtual void OnStateTransition (double progress)
 Fired during the raising and lowering states, if SetStateTransitionDuration() was set. More...
 
void SetPhaseTransitionDuration (Util::OS::timestamp_t ms)
 Set the maximum duration of the starting or stopping phases. More...
 
void SetStateTransitionDuration (Util::OS::timestamp_t ms)
 Set the maximum duration of the raising or lowering state. More...
 

Protected Attributes

GameDirectordirector
 
Display::Displaydisplay
 
std::shared_ptr< Rulesrules
 
Script::Corescripting
 
ClientSessionsession
 
std::vector< Viewportviewports
 
- Protected Attributes inherited from HoverRace::Client::Scene
std::shared_ptr< Util::ProfileradvanceProfiler
 
std::shared_ptr< Util::ProfilerprepareProfiler
 
std::shared_ptr< Util::ProfilerrenderProfiler
 
std::shared_ptr< Util::ProfilerrootProfiler
 

Private Types

using SUPER = UiScene
 

Private Member Functions

void Cleanup ()
 
void LayoutViewports ()
 Redefine the bounds of each viewport based on the number of connected local players. More...
 
void OnRaceFinish ()
 
void ScheduleLoad (std::shared_ptr< Util::Loader > loader)
 

Private Attributes

bool finishedLoading
 
boost::signals2::scoped_connection finishedLoadingConn
 
std::shared_ptr< HoverScript::MetaSessionmetaSession
 
bool muted
 

Additional Inherited Members

- Public Types inherited from HoverRace::Client::Scene
enum  Phase {
  Phase::INITIALIZING, Phase::STARTING, Phase::RUNNING, Phase::STOPPING,
  Phase::STOPPED
}
 
enum  State {
  State::INITIALIZING, State::BACKGROUND, State::RAISING, State::FOREGROUND,
  State::LOWERING
}
 

Detailed Description

Base for scenes that render and interact with tracks.

Author
Michael Imamura

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Client::GameScene::GameScene ( const std::string &  name,
Display::Display display,
GameDirector director,
Script::Core scripting,
std::shared_ptr< Rules rules,
std::shared_ptr< Util::Loader loader 
)
HoverRace::Client::GameScene::~GameScene ( )
virtual

Member Function Documentation

void HoverRace::Client::GameScene::Advance ( Util::OS::timestamp_t  tick)
overridevirtual

Reimplemented from HoverRace::Client::Scene.

void HoverRace::Client::GameScene::Cleanup ( )
private
bool HoverRace::Client::GameScene::IsMouseCursorEnabled ( ) const
inlineoverridevirtual

Determine if the mouse cursor is enabled for this scene.

Returns
true if the cursor should be shown, false if it should be hidden.

Implements HoverRace::Client::Scene.

void HoverRace::Client::GameScene::Layout ( )
overridevirtual

Adjust the size and position of any child elements.

Subclasses with child elements that are relative to each other should override this function.

This is called automatically during the PrepareRender() phase if RequestLayout() has been called. It is also called the first time PrepareRender() is invoked. After this function is called, it will not be called again until another call to RequestLayout().

Reimplemented from HoverRace::Client::UiScene.

void HoverRace::Client::GameScene::LayoutViewports ( )
private

Redefine the bounds of each viewport based on the number of connected local players.

void HoverRace::Client::GameScene::OnFinishedLoading ( )
protectedvirtual
void HoverRace::Client::GameScene::OnRaceFinish ( )
private
std::ostream & HoverRace::Client::GameScene::OutputDebugText ( std::ostream &  oss) const
overridevirtual

Output a stream of debug information describing this scene.

The output text may include newlines.

Parameters
[in,out]ossThe output stream to write to.
Returns
The same output stream as was passed in.

Reimplemented from HoverRace::Client::Scene.

void HoverRace::Client::GameScene::PrepareRender ( )
overridevirtual

Reimplemented from HoverRace::Client::Scene.

void HoverRace::Client::GameScene::Render ( )
overridevirtual
void HoverRace::Client::GameScene::ScheduleLoad ( std::shared_ptr< Util::Loader loader)
private
void HoverRace::Client::GameScene::SetHudVisible ( bool  visible)
protected
void HoverRace::Client::GameScene::SetMuted ( bool  muted)
protected

Member Data Documentation

GameDirector& HoverRace::Client::GameScene::director
protected
Display::Display& HoverRace::Client::GameScene::display
protected
bool HoverRace::Client::GameScene::finishedLoading
private
boost::signals2::scoped_connection HoverRace::Client::GameScene::finishedLoadingConn
private
std::shared_ptr<HoverScript::MetaSession> HoverRace::Client::GameScene::metaSession
private
bool HoverRace::Client::GameScene::muted
private
std::shared_ptr<Rules> HoverRace::Client::GameScene::rules
protected
Script::Core& HoverRace::Client::GameScene::scripting
protected
ClientSession* HoverRace::Client::GameScene::session
protected
std::vector<Viewport> HoverRace::Client::GameScene::viewports
protected

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