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

Base class for scenes with a title and status area. More...

#include <DialogScene.h>

+ Inheritance diagram for HoverRace::Client::DialogScene:

Public Member Functions

 DialogScene (Display::Display &display, GameDirector &director, const std::string &parentTitle, const std::string &title, const std::string &name)
 Constructor. More...
 
 DialogScene (Display::Display &display, GameDirector &director, const std::string &title="", const std::string &name="")
 
virtual ~DialogScene ()
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. More...
 
void DetachController (Control::InputEventController &controller, ConnList &conns) override
 Remove the controller mappings. More...
 
void OnPhaseTransition (double progress) override
 Fired during the starting and stopping phases, if SetPhaseTransitionDuration() was set. More...
 
void PrepareRender () override
 
void Render () override
 
- Public Member Functions inherited from HoverRace::Client::FormScene
 FormScene (Display::Display &display, const std::string &name="")
 
virtual ~FormScene ()
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. 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
 
virtual std::ostream & OutputDebugText (std::ostream &oss) const
 Output a stream of debug information describing this scene. More...
 
void PrepareScene ()
 
void RenderScene ()
 
bool SetPhase (Phase phase)
 Switch to another phase. More...
 

Static Public Attributes

static constexpr double MARGIN_WIDTH = 40
 

Protected Member Functions

Display::ContainerGetContentRoot () const
 
const std::string & GetFullTitle () const
 Retrieve the full combined title (including parent title). More...
 
Display::ContainerGetStatusRoot () const
 
const std::string & GetTitle () const
 
virtual void OnCancel ()
 Called when the "Cancel" action is fired. More...
 
virtual void OnExtra ()
 Called when the scene-specific extra action is fired. More...
 
virtual void OnOk ()
 Called when the "OK" action is fired. More...
 
void SetBackground (Display::Background *fader)
 Set the background, replacing the currently set background. More...
 
void SetStoppingTransitionEnabled (bool enabled)
 Enable or disable content visibility while scene is stopping. More...
 
void SupportCancelAction (const std::string &label="")
 Enable the "Cancel" action for this scene. More...
 
void SupportExtraAction (const std::string &label)
 Enable the "extra" action for this scene. More...
 
void SupportOkAction (const std::string &label="")
 Enable the "OK" action for this scene. More...
 
- Protected Member Functions inherited from HoverRace::Client::FormScene
Display::ContainerGetRoot () const
 
- Protected Member Functions inherited from HoverRace::Client::UiScene
virtual void Layout ()
 Adjust the size and position of any child elements. More...
 
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
virtual void Advance (Util::OS::timestamp_t tick)
 
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 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...
 

Static Protected Member Functions

static std::string JoinTitles (const std::string &parent, const std::string &title)
 Combine a parent dialog title to the child dialog title. More...
 

Protected Attributes

GameDirectordirector
 
- Protected Attributes inherited from HoverRace::Client::FormScene
Display::Displaydisplay
 
- 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 = FormScene
 

Private Attributes

std::shared_ptr< Display::FlexGridactionGrid
 
size_t actionGridCol
 
std::shared_ptr< Display::ActionButtoncancelBtn
 
std::shared_ptr< Display::ContainercontentRoot
 
std::shared_ptr< Display::ActionButtonextraBtn
 
std::unique_ptr< Display::Backgroundfader
 
std::string fullTitle
 
std::shared_ptr< Display::ActionButtonokBtn
 
std::string parentTitle
 
std::shared_ptr< Display::ContainerstatusRoot
 
bool stoppingTransitionEnabled
 
std::string title
 
Display::Color titleColor
 
std::shared_ptr< Display::FlexGridtitleGrid
 
std::shared_ptr< Display::LabeltitleLbl
 
std::shared_ptr< Display::LabeltitleSepLbl
 

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 class for scenes with a title and status area.

Author
Michael Imamura

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Client::DialogScene::DialogScene ( Display::Display display,
GameDirector director,
const std::string &  parentTitle,
const std::string &  title,
const std::string &  name 
)

Constructor.

Parameters
displayThe display.
directorThe current game director.
parentTitleThe title of the parent dialog (blank if none).
titleThe title to display.
nameThe name of the scene. See Scene::GetName.
HoverRace::Client::DialogScene::DialogScene ( Display::Display display,
GameDirector director,
const std::string &  title = "",
const std::string &  name = "" 
)
inline
HoverRace::Client::DialogScene::~DialogScene ( )
virtual

Member Function Documentation

void HoverRace::Client::DialogScene::AttachController ( Control::InputEventController controller,
ConnList conns 
)
overridevirtual

Configure the controller mappings.

This is called whenever the scene becomes the foreground scene or the controller config needs to be rebuilt.

Parameters
controllerThe current controller being used. It can be assumed that the controller's action mappings have been cleared.
connsThe list to manage connections while the input is attached. Any connections added to this list will be automatically disconnected when then the input is detached.

Implements HoverRace::Client::Scene.

Reimplemented in HoverRace::Client::TextEditScene.

void HoverRace::Client::DialogScene::DetachController ( Control::InputEventController controller,
ConnList conns 
)
overridevirtual

Remove the controller mappings.

Parameters
controllerThe current controller being used. It can be assumed that the controller's action mappings have been cleared.
connsThe same connection list passed to AttachController.

Implements HoverRace::Client::Scene.

Reimplemented in HoverRace::Client::TextEditScene.

Display::Container* HoverRace::Client::DialogScene::GetContentRoot ( ) const
inlineprotected
const std::string& HoverRace::Client::DialogScene::GetFullTitle ( ) const
inlineprotected

Retrieve the full combined title (including parent title).

Returns
The full title.
Display::Container* HoverRace::Client::DialogScene::GetStatusRoot ( ) const
inlineprotected
const std::string& HoverRace::Client::DialogScene::GetTitle ( ) const
inlineprotected
std::string HoverRace::Client::DialogScene::JoinTitles ( const std::string &  parent,
const std::string &  title 
)
staticprotected

Combine a parent dialog title to the child dialog title.

Parameters
parentThe parent title (may be empty).
titleThe child title.
Returns
The combined title.
void HoverRace::Client::DialogScene::OnCancel ( )
protectedvirtual
void HoverRace::Client::DialogScene::OnExtra ( )
protectedvirtual

Called when the scene-specific extra action is fired.

Reimplemented in HoverRace::Client::SettingsScene.

void HoverRace::Client::DialogScene::OnOk ( )
protectedvirtual
void HoverRace::Client::DialogScene::OnPhaseTransition ( double  progress)
overridevirtual

Fired during the starting and stopping phases, if SetPhaseTransitionDuration() was set.

Parameters
progressThe animation progress (during the STARTING phase this goes from 0.0 to 1.0, and in reverse for the STOPPING phase).

Reimplemented from HoverRace::Client::Scene.

Reimplemented in HoverRace::Client::GameSelectScene, and HoverRace::Client::TrackSelectScene.

void HoverRace::Client::DialogScene::PrepareRender ( )
overridevirtual
void HoverRace::Client::DialogScene::Render ( )
overridevirtual
void HoverRace::Client::DialogScene::SetBackground ( Display::Background fader)
protected

Set the background, replacing the currently set background.

Parameters
faderThe background of the scene (may be nullptr for no background). Ownership is passed to the DialogScene.
void HoverRace::Client::DialogScene::SetStoppingTransitionEnabled ( bool  enabled)
protected

Enable or disable content visibility while scene is stopping.

By default, dialog scenes hide the root container immediately when the scene enters the STOPPING phase. Setting this to true keeps the root container visible so that transitions can be applied.

Parameters
enabledtrue to enable, false to disable.
void HoverRace::Client::DialogScene::SupportCancelAction ( const std::string &  label = "")
protected

Enable the "Cancel" action for this scene.

This must only be called from the constructor, and must only be called once.

Parameters
labelThe optional fixed label for the button (will use default action name if empty).
void HoverRace::Client::DialogScene::SupportExtraAction ( const std::string &  label)
protected

Enable the "extra" action for this scene.

By default, scenes do not have an "extra" action, only OK and Cancel. Activating this action will add a button to the status bar with the specified label.

This must only be called from the constructor, and must only be called once.

Parameters
labelThe label for the button.
void HoverRace::Client::DialogScene::SupportOkAction ( const std::string &  label = "")
protected

Enable the "OK" action for this scene.

This must only be called from the constructor, and must only be called once.

Parameters
labelThe optional fixed label for the button (will use default action name if empty).

Member Data Documentation

std::shared_ptr<Display::FlexGrid> HoverRace::Client::DialogScene::actionGrid
private
size_t HoverRace::Client::DialogScene::actionGridCol
private
std::shared_ptr<Display::ActionButton> HoverRace::Client::DialogScene::cancelBtn
private
std::shared_ptr<Display::Container> HoverRace::Client::DialogScene::contentRoot
private
GameDirector& HoverRace::Client::DialogScene::director
protected
std::shared_ptr<Display::ActionButton> HoverRace::Client::DialogScene::extraBtn
private
std::unique_ptr<Display::Background> HoverRace::Client::DialogScene::fader
private
std::string HoverRace::Client::DialogScene::fullTitle
private
constexpr double HoverRace::Client::DialogScene::MARGIN_WIDTH = 40
static
std::shared_ptr<Display::ActionButton> HoverRace::Client::DialogScene::okBtn
private
std::string HoverRace::Client::DialogScene::parentTitle
private
std::shared_ptr<Display::Container> HoverRace::Client::DialogScene::statusRoot
private
bool HoverRace::Client::DialogScene::stoppingTransitionEnabled
private
std::string HoverRace::Client::DialogScene::title
private
Display::Color HoverRace::Client::DialogScene::titleColor
private
std::shared_ptr<Display::FlexGrid> HoverRace::Client::DialogScene::titleGrid
private
std::shared_ptr<Display::Label> HoverRace::Client::DialogScene::titleLbl
private
std::shared_ptr<Display::Label> HoverRace::Client::DialogScene::titleSepLbl
private

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