Emergency 20 Dokumentation  4.2.0
FreeplayWindow.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 //[-------------------------------------------------------]
15 #include "em5/map/MapIdentifier.h"
16 
17 #include <qsf/job/JobProxy.h>
18 #include <qsf/time/DateTime.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public methods ]
41  //[-------------------------------------------------------]
42  public:
43  explicit FreeplayWindow(qsf::GuiContext& guiContext);
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public virtual qsf::GuiDocument methods ]
48  //[-------------------------------------------------------]
49  public:
50  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
51 
52 
53  //[-------------------------------------------------------]
54  //[ Protected virtual em5::MainMenuWindowBase methods ]
55  //[-------------------------------------------------------]
56  protected:
57  virtual void onGoingBack() override;
58 
59 
60  //[-------------------------------------------------------]
61  //[ Protected virtual em5::GuiHotReloadSupport methods ]
62  //[-------------------------------------------------------]
63  protected:
64  virtual void onReloadGui() override;
65  virtual bool onDocumentPreShow() override;
66  virtual void onDocumentPreHide() override;
67 
68 
69  //[-------------------------------------------------------]
70  //[ Private methods ]
71  //[-------------------------------------------------------]
72  private:
73  void setupUI();
74  void addMapButton(const MapIdentifier& mapIdentifier, const std::string& text, const std::string& image);
75  void setInfo();
76  void startMap();
77 
78  qsf::DateTime getYoungestDate(const boost::container::flat_set<HighscoreEntry>& set);
79 
80  void blinkCampaignButton();
81  void onBlink(const qsf::JobArguments& jobArguments);
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private definitions ]
86  //[-------------------------------------------------------]
87  private:
88  struct MapButtonData
89  {
90  MapIdentifier mMapIdentifier;
91  std::string mPreviewImage;
92  };
93  typedef std::vector<MapButtonData> MapButtonArray;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private data ]
98  //[-------------------------------------------------------]
99  private:
100  int mSelectedIndex;
101  MapButtonArray mMapButtons;
102  int mOriginalMapNameInformationFontSize;
103 
104  // Blinking
105  float mBlinkPhase;
106  qsf::JobProxy mBlinkJobProxy;
107 
108 
109  };
110 
111 
112 //[-------------------------------------------------------]
113 //[ Namespace ]
114 //[-------------------------------------------------------]
115 } // em5
Definition: ActionPriority.h:13
Data type for encapsulating date time information (in UTC)
Definition: DateTime.h:37
Job proxy class.
Definition: JobProxy.h:51
Freeplay window.
Definition: FreeplayWindow.h:35
virtual void processEvent(const std::string &eventKey, Rocket::Core::Event &event) override
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
virtual bool onDocumentPreShow() override
Base window for main menu windows.
Definition: MainMenuWindowBase.h:40
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
EMERGENCY 5 map identifier class.
Definition: MapIdentifier.h:34
virtual void onGoingBack() override
virtual void onDocumentPreHide() override
virtual void onReloadGui() override
Gets called when the GUI should be reloaded.
FreeplayWindow(qsf::GuiContext &guiContext)