Emergency 20 Dokumentation  4.2.0
WarblerFeedWindow.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
15 #include <qsf/gui/GuiDocument.h>
16 #include <qsf/job/JobProxy.h>
17 #include <qsf/math/Color3.h>
18 #include <qsf/math/BitFlagSet.h>
19 
20 #include <glm/glm.hpp>
21 #include <glm/gtc/quaternion.hpp>
22 
23 
24 //[-------------------------------------------------------]
25 //[ Forward declarations ]
26 //[-------------------------------------------------------]
27 namespace Ogre
28 {
29  class Image;
30  class Texture;
31  template<typename T> class SharedPtr;
33 }
34 
35 
36 //[-------------------------------------------------------]
37 //[ Namespace ]
38 //[-------------------------------------------------------]
39 namespace em5
40 {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Classes ]
45  //[-------------------------------------------------------]
51  {
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public definitions ]
56  //[-------------------------------------------------------]
57  public:
58  enum Flag
59  {
60  SHOW_NEW_TWEETS_AUTOMATICALLY = 1<<0,
61  SHOW_WARBLER_FEED_BUTTON_ON_NEW_TWEET = 1<<1,
62  PLAY_AUDIO_ON_NEW_TWEET = 1<<2,
63  PAUSE_GAME_ON_SHOW_WINDOW = 1<<3,
64  SHOW_COMMENT_ICON = 1<<4,
65  SHOW_SHARE_ICON = 1<<5,
66  SHOW_LIKE_ICON = 1<<6,
67  BLOCK_INPUT = 1<<7,
68  EDITABLE_TEXT = 1<<8,
69  };
71 
72  struct WarblerTweet
73  {
74  std::string text;
76  glm::vec3 cameraPosition;
77  glm::quat cameraRotation;
78  Rocket::Core::Element* element;
79  float height;
81  };
82  typedef std::vector<WarblerTweet> WarblerTweets;
83 
84 
85  //[-------------------------------------------------------]
86  //[ Public boost signals ]
87  //[-------------------------------------------------------]
88  public:
96  boost::signals2::signal<void(const std::string&, int)> WarblerTextChanged;
97 
98 
99  //[-------------------------------------------------------]
100  //[ Public static methods ]
101  //[-------------------------------------------------------]
102  public:
103  static bool shouldWarblerFeedWindowBeEnabled();
104  static bool isWarblerFeedWindowEnabled();
105  static void clearWarblerFeed();
106 
107 
108  //[-------------------------------------------------------]
109  //[ Public methods ]
110  //[-------------------------------------------------------]
111  public:
112  explicit WarblerFeedWindow(qsf::GuiContext& guiContext);
113  virtual ~WarblerFeedWindow();
114 
119  inline bool isEnabled() const;
120 
125  void setEnabled(bool enabled);
126 
131  inline Flags getFlags() const;
132 
137  inline void setFlags(Flags flags);
138 
150  void addWarblerTweet(const std::string& text, uint64 cameraEntityId, const std::string& rmlTitleAsString = "");
151 
166  int addFixedImageWarblerTweet(const std::string& text, const std::string& imageLocalFilename, const std::string& rmlTitleAsString = "");
167 
182  int addExternalWarblerTweet(const std::string& text, Ogre::Image& ogreImage, const std::string& rmlTitleAsString = "");
183 
188  void clear();
189 
194  inline const WarblerTweets& getWarblerTweets() const;
195 
196 
197  //[-------------------------------------------------------]
198  //[ Public virtual qsf::GuiDocument methods ]
199  //[-------------------------------------------------------]
200  public:
201  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
202 
203 
204  //[-------------------------------------------------------]
205  //[ Private virtual qsf::GuiDocument methods ]
206  //[-------------------------------------------------------]
207  private:
208  virtual bool onPreShow() override;
209  virtual void onPreHide() override;
210 
211 
212  //[-------------------------------------------------------]
213  //[ Private methods ]
214  //[-------------------------------------------------------]
215  private:
216  void setupGui();
217  void onReloadGui();
218 
223  void onAnimationUpdate(const qsf::JobArguments& jobArguments);
224 
225  void onWarblerShotRendering(uint64 camearEntityId, Ogre::Image* ogreImage = nullptr);
226 
227 
228  //[-------------------------------------------------------]
229  //[ Private data ]
230  //[-------------------------------------------------------]
231  private:
232  bool mEnabled;
233  Flags mFlags;
234  qsf::JobProxy mAnimationJobProxy;
235  qsf::JobProxy mMakeShotJobProxy;
236  WarblerTweets mWarblerTweets;
237  WarblerTweets mNewWarblerTweets;
238  bool mCurrentInputBlockedState;
239  std::string mNextWarblerText;
240  std::string mNextWarblerRmlTitleAsString;
241  uint32 mTextureCounter;
242 
243 
244  };
245 
246 
247 //[-------------------------------------------------------]
248 //[ Namespace ]
249 //[-------------------------------------------------------]
250 } // em5
251 
252 
253 //[-------------------------------------------------------]
254 //[ Implementation ]
255 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
float height
Holds height of the element.
Definition: WarblerFeedWindow.h:79
unsigned int uint32
Definition: PlatformTypes.h:181
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
std::string text
Definition: WarblerFeedWindow.h:74
uint64_t uint64
Definition: PlatformTypes.h:184
Ogre::TexturePtr * ogreTexturePtr
Definition: WarblerFeedWindow.h:80
std::vector< WarblerTweet > WarblerTweets
Definition: WarblerFeedWindow.h:82
glm::quat cameraRotation
Store the camera rotation at the point in time of capturing the screenshot, the camera might move lat...
Definition: WarblerFeedWindow.h:77
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
boost::signals2::signal< void(const std::string &, int)> WarblerTextChanged
Called when an editable tweet text has changed.
Definition: WarblerFeedWindow.h:96
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
uint64 cameraEntityId
Definition: WarblerFeedWindow.h:75
Flag
Definition: WarblerFeedWindow.h:58
Definition: WarblerFeedWindow.h:31
glm::vec3 cameraPosition
Store the camera position at the point in time of capturing the screenshot, the camera might move lat...
Definition: WarblerFeedWindow.h:76
Definition: WarblerFeedWindow.h:72
qsf::BitFlagSet< uint16, Flag > Flags
Definition: WarblerFeedWindow.h:70
Definition: BuildingClippingManager.h:23
The warbler feed window was introduced in EMERGENCY 2017 and hence is only available in this version ...
Definition: WarblerFeedWindow.h:50
SharedPtr< Texture > TexturePtr
Definition: WarblerFeedWindow.h:31
Rocket::Core::Element * element
Holds the close event objective window element.
Definition: WarblerFeedWindow.h:78