Emergency 20 Dokumentation  4.2.0
LoadingScreen.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
15 #include <qsf/gui/GuiDocument.h>
16 
17 #include <boost/signals2/signal.hpp>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class ProgressBar;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
55  explicit LoadingScreen(qsf::GuiContext& guiContext);
56 
61  virtual ~LoadingScreen();
62 
70  void setPercentage(float percentage);
71 
79  void setBackgroundImage(const std::string& image);
80 
88  void enableProgressbar(bool enable);
89 
90 
91  //[-------------------------------------------------------]
92  //[ Public virtual qsf::GuiDocument methods ]
93  //[-------------------------------------------------------]
94  public:
95  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private virtual qsf::GuiDocument methods ]
100  //[-------------------------------------------------------]
101  private:
102  virtual bool onPreShow() override;
103  virtual void onPreHide() override;
104 
105 
106  //[-------------------------------------------------------]
107  //[ Private methods ]
108  //[-------------------------------------------------------]
109  private:
114  void onReadyForGame();
115  void showMultiplayerStartGameButton(bool show);
116  void showMultiplayerReadyInfo(bool show);
117  void showErrorMessage(bool show);
118 
123  void onPlayerLeft(uint32 playerIndex, const multiplayer::SessionBase::PlayerInfo& playerInfo);
124 
129  void onStateChange(multiplayer::SessionBase::State prevState, multiplayer::SessionBase::State newState);
130 
131  void disconnectSignals();
132 
133 
134  //[-------------------------------------------------------]
135  //[ Private data ]
136  //[-------------------------------------------------------]
137  private:
138  ProgressBar* mProgressBar;
139  bool mProgressBarEnabled;
140  bool mIsConnected;
141  boost::signals2::connection mPlayerLeftSignalConnection;
142  boost::signals2::connection mConnectionLostSignalConnection;
143 
144 
145  };
146 
147 
148 //[-------------------------------------------------------]
149 //[ Namespace ]
150 //[-------------------------------------------------------]
151 } // em5
Definition: ActionPriority.h:13
void setPercentage(float percentage)
Set the progress bar percentage.
virtual void processEvent(const std::string &eventKey, Rocket::Core::Event &event) override
unsigned int uint32
Definition: PlatformTypes.h:181
void setBackgroundImage(const std::string &image)
Set background image.
Progress bar class.
Definition: ProgressBar.h:42
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
LoadingScreen(qsf::GuiContext &guiContext)
Constructor.
Definition: SessionBase.h:105
State
Definition: SessionBase.h:93
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
virtual ~LoadingScreen()
Destructor.
Loading screen GUI window.
Definition: LoadingScreen.h:43
void enableProgressbar(bool enable)
Enable and disable progress bar.
void show()
Show the document.