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

Displays a message to the user. More...

#include <MessageScene.h>

+ Inheritance diagram for HoverRace::Client::MessageScene:

Public Types

using cancelSignal_t = boost::signals2::signal< void()>
 
using okSignal_t = boost::signals2::signal< void()>
 
- 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
}
 

Public Member Functions

 MessageScene (Display::Display &display, GameDirector &director, const std::string &title, const std::string &message, bool hasCancel=false)
 Constructor. More...
 
virtual ~MessageScene ()
 
void AttachController (Control::InputEventController &controller, ConnList &conns) override
 Configure the controller mappings. More...
 
cancelSignal_tGetCancelSignal ()
 
okSignal_tGetOkSignal ()
 
void Layout () override
 Adjust the size and position of any child elements. 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 ()
 
- 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...
 

Private Types

using SUPER = FormScene
 

Private Member Functions

void OnCancel ()
 
void OnOk ()
 

Private Attributes

std::shared_ptr< Display::ActionButtoncancelBtn
 
cancelSignal_t cancelSignal
 
GameDirectordirector
 
std::unique_ptr< Display::ScreenFadefader
 
bool hasCancel
 
std::shared_ptr< Display::LabelmessageLbl
 
std::shared_ptr< Display::ButtonokBtn
 
boost::signals2::scoped_connection okConn
 
okSignal_t okSignal
 
std::shared_ptr< Display::LabeltitleLbl
 

Static Private Attributes

static const int HORZ_PADDING = 40
 

Additional Inherited Members

- Protected Member Functions inherited from HoverRace::Client::FormScene
Display::ContainerGetRoot () const
 
- 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
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...
 
- 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
 

Detailed Description

Displays a message to the user.

Author
Michael Imamura

Member Typedef Documentation

using HoverRace::Client::MessageScene::cancelSignal_t = boost::signals2::signal<void()>
using HoverRace::Client::MessageScene::okSignal_t = boost::signals2::signal<void()>

Constructor & Destructor Documentation

HoverRace::Client::MessageScene::MessageScene ( Display::Display display,
GameDirector director,
const std::string &  title,
const std::string &  message,
bool  hasCancel = false 
)

Constructor.

Parameters
displayThe current display.
directorThe current game director.
titleThe title text (may be empty).
messageThe message text (may be empty).
hasCanceltrue for both "OK" and "Cancel" buttons, false for only an "OK" button.
HoverRace::Client::MessageScene::~MessageScene ( )
virtual

Member Function Documentation

void HoverRace::Client::MessageScene::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.

Reimplemented from HoverRace::Client::FormScene.

cancelSignal_t& HoverRace::Client::MessageScene::GetCancelSignal ( )
inline
okSignal_t& HoverRace::Client::MessageScene::GetOkSignal ( )
inline
void HoverRace::Client::MessageScene::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::MessageScene::OnCancel ( )
private
void HoverRace::Client::MessageScene::OnOk ( )
private
void HoverRace::Client::MessageScene::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.

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

Reimplemented from HoverRace::Client::FormScene.

void HoverRace::Client::MessageScene::Render ( )
overridevirtual

Reimplemented from HoverRace::Client::FormScene.

Member Data Documentation

std::shared_ptr<Display::ActionButton> HoverRace::Client::MessageScene::cancelBtn
private
cancelSignal_t HoverRace::Client::MessageScene::cancelSignal
private
GameDirector& HoverRace::Client::MessageScene::director
private
std::unique_ptr<Display::ScreenFade> HoverRace::Client::MessageScene::fader
private
bool HoverRace::Client::MessageScene::hasCancel
private
const int HoverRace::Client::MessageScene::HORZ_PADDING = 40
staticprivate
std::shared_ptr<Display::Label> HoverRace::Client::MessageScene::messageLbl
private
std::shared_ptr<Display::Button> HoverRace::Client::MessageScene::okBtn
private
boost::signals2::scoped_connection HoverRace::Client::MessageScene::okConn
private
okSignal_t HoverRace::Client::MessageScene::okSignal
private
std::shared_ptr<Display::Label> HoverRace::Client::MessageScene::titleLbl
private

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