HoverRace  2.0
MessageScene.h
Go to the documentation of this file.
1 
2 // MessageScene.h
3 //
4 // Copyright (c) 2013-2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "../../engine/Util/Config.h"
25 
26 #include "GameDirector.h"
27 
28 #include "FormScene.h"
29 
30 namespace HoverRace {
31  namespace Display {
32  class ActionButton;
33  class Button;
34  class Display;
35  class Label;
36  class ScreenFade;
37  }
38 }
39 
40 namespace HoverRace {
41 namespace Client {
42 
47 class MessageScene : public FormScene
48 {
49  using SUPER = FormScene;
50 
51 public:
53  const std::string &title, const std::string &message,
54  bool hasCancel = false);
55  virtual ~MessageScene();
56 
57 private:
58  void OnOk();
59  void OnCancel();
60 
61 public:
62  using okSignal_t = boost::signals2::signal<void()>;
63  okSignal_t &GetOkSignal() { return okSignal; }
64 
65  using cancelSignal_t = boost::signals2::signal<void()>;
66  cancelSignal_t &GetCancelSignal() { return cancelSignal; }
67 
68 public:
69  // Scene
70  void AttachController(Control::InputEventController &controller,
71  ConnList &conns) override;
72  void OnPhaseTransition(double progress) override;
73  void Layout() override;
74  void PrepareRender() override;
75  void Render() override;
76 
77 private:
79  bool hasCancel;
80 
83 
84  std::unique_ptr<Display::ScreenFade> fader;
85  std::shared_ptr<Display::Label> titleLbl;
86  std::shared_ptr<Display::Label> messageLbl;
87  std::shared_ptr<Display::Button> okBtn;
88  std::shared_ptr<Display::ActionButton> cancelBtn;
89 
90  boost::signals2::scoped_connection okConn;
91 
92  static const int HORZ_PADDING = 40;
93 };
94 
95 } // namespace Client
96 } // namespace HoverRace
bool hasCancel
Definition: MessageScene.h:79
std::shared_ptr< Display::Label > titleLbl
Definition: MessageScene.h:85
Displays a message to the user.
Definition: MessageScene.h:47
Interface for game client shells.
Definition: GameDirector.h:57
okSignal_t & GetOkSignal()
Definition: MessageScene.h:63
Base class for UI-centric scenes.
Definition: UiScene.h:42
cancelSignal_t cancelSignal
Definition: MessageScene.h:82
GameDirector & director
Definition: TestLabScene.cpp:160
std::array< boost::signals2::scoped_connection, 2 > conns
Definition: ProfileEditScene.cpp:152
boost::signals2::signal< void()> okSignal_t
Definition: MessageScene.h:62
Base class for display managers.
Definition: Display.h:73
Base class for full-scene menus and the like.
Definition: FormScene.h:48
boost::signals2::scoped_connection okConn
Definition: MessageScene.h:90
std::shared_ptr< Display::Button > okBtn
Definition: MessageScene.h:87
std::unique_ptr< Display::ScreenFade > fader
Definition: MessageScene.h:84
Tracks connections as a group.
Definition: Scene.h:69
boost::signals2::signal< void()> cancelSignal_t
Definition: MessageScene.h:65
Definition: Announcement.h:24
cancelSignal_t & GetCancelSignal()
Definition: MessageScene.h:66
okSignal_t okSignal
Definition: MessageScene.h:81
std::shared_ptr< Display::ActionButton > cancelBtn
Definition: MessageScene.h:88
std::shared_ptr< Display::Label > messageLbl
Definition: MessageScene.h:86
GameDirector & director
Definition: MessageScene.h:78
Translates input events into actions.
Definition: Controller.h:106