Crazy Eddie's GUI System  ${CEGUI_VERSION}
GameMenu.h
1 /***********************************************************************
2 created: 31/7/2012
3 author: Lukas E Meindl
4 *************************************************************************/
5 /***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27 #ifndef _Game_Menu_Demo_
28 #define _Game_Menu_Demo_
29 
30 #include "SampleBase.h"
31 
32 namespace CEGUI
33 {
34  class GUIContext;
35 }
36 
37 enum WriteFocus
38 {
39  WF_TopBar,
40  WF_BotBar,
41 
42  WF_Count
43 };
44 
45 
46 // Sample class
47 class GameMenuDemo : public Sample
48 {
49 public:
50  // method to initialse the samples windows and events.
51  virtual bool initialise(CEGUI::GUIContext* guiContext);
52 
53  // method to perform any required cleanup operations.
54  virtual void deinitialise();
55 
56  virtual void onEnteringSample();
57 
58  virtual void update(float timeSinceLastUpdate);
59 
60 
61 protected:
62  void setupWindows();
63 
64  void setupInnerButtonsSubOptionsLabels();
65  void setupNaviArrowWindows();
66  void setupButtonClickHandlers();
67  void setupNaviIconAnimationEventHandlers();
68  void setupAnimations();
69 
70  void setupSelectionIconAnimations();
71  void setupPopupLinesAnimations();
72  void resetAnimations();
73  void startEntranceAnimations();
74 
75  void updateIntroText();
76  void updateLoginWelcomeText(float passedTime);
77  void updateLoginStartButtonText(float passedTime);
78  void disableInteractivePlanetElements();
79  void enableInteractivePlanetElements();
80  void enableNavigationBarElements();
81  void disableNavigationBarElements();
82 
83  bool handleLoginAcceptButtonClicked(const CEGUI::EventArgs& args);
84  bool handleInnerPartStartClickAreaClick(const CEGUI::EventArgs& args);
85  bool handleCheckIfNaviIconAnimationNeedsChange(const CEGUI::EventArgs& args);
86  bool handleNaviSelectionIconAnimStart(const CEGUI::EventArgs& args);
87 
88  bool handleMouseEntersLeftArrowArea(const CEGUI::EventArgs& args);
89  bool handleMouseLeavesLeftArrowArea(const CEGUI::EventArgs& args);
90  bool handleMouseEntersRightArrowArea(const CEGUI::EventArgs& args);
91  bool handleMouseLeavesRightArrowArea(const CEGUI::EventArgs& args);
92 
93  bool handleStartPopupLinesSaveDisplay(const CEGUI::EventArgs& args);
94  bool handleStartPopupLinesLoadDisplay(const CEGUI::EventArgs& args);
95  bool handleStartPopupLinesCharactersDisplay(const CEGUI::EventArgs& args);
96  bool handleStartPopupLinesOptionsDisplay(const CEGUI::EventArgs& args);
97  bool handleStartPopupLinesQuitDisplay(const CEGUI::EventArgs& args);
98 
99  bool handleInnerButtonsLabelEntered(const CEGUI::EventArgs& args);
100 
101  CEGUI::Window* getIconWindowFromLabel(CEGUI::Window* window);
102  bool handleInnerButtonsLabelLeft(const CEGUI::EventArgs& args);
103 
104  void makeAllSelectionIconsInvisible();
105  void stopStartPopupLinesAnimations();
106 
107  static const float s_firstStartDelay;
108  static const float s_secondStartDelay;
109  static const float s_loginDisplayStartDelay;
110 
111 
112  CEGUI::GUIContext* d_guiContext;
113  CEGUI::Window* d_root;
114 
115  float d_timeSinceStart;
116 
117  float d_timeSinceLoginAccepted;
118 
119  bool d_interactiveElementsWereInitiallyBlendedOut;
120  bool d_interactivePlanetElementsAreEnabled;
121  bool d_navigationIsEnabled;
122  bool d_loginWasAccepted;
123  bool d_mouseIsHoveringNavi;
124  bool d_startButtonClicked;
125 
126  WriteFocus d_currentWriteFocus;
127 
128  CEGUI::String d_userName;
129 
130  CEGUI::AnimationInstance* d_topBarAnimInst;
131  CEGUI::AnimationInstance* d_botBarAnimInst;
132  CEGUI::AnimationInstance* d_insideBlendInAnimInst;
133  CEGUI::AnimationInstance* d_insideImage3RotateInInst;
134  CEGUI::AnimationInstance* d_insideImage4RotateInInst;
135  CEGUI::AnimationInstance* d_insideImageRingsContainerSizeInInst;
136 
137  CEGUI::AnimationInstance* d_buttonFadeInAnimInst1;
138  CEGUI::AnimationInstance* d_buttonFadeInAnimInst2;
139  CEGUI::AnimationInstance* d_buttonFadeInAnimInst3;
140  CEGUI::AnimationInstance* d_buttonFadeInAnimInst4;
141  CEGUI::AnimationInstance* d_buttonFadeInAnimInst5;
142 
143  CEGUI::AnimationInstance* d_loginContainerMoveInInst;
144  CEGUI::AnimationInstance* d_loginContainerMoveOutInst;
145  CEGUI::AnimationInstance* d_naviButtonLeftMoveInInst;
146  CEGUI::AnimationInstance* d_naviButtonRightMoveInInst;
147  CEGUI::AnimationInstance* d_naviBotMoveInInst;
148  CEGUI::AnimationInstance* d_startButtonBlendInAnimInst;
149  CEGUI::AnimationInstance* d_navigationLabelBlendInAnimInst;
150  CEGUI::AnimationInstance* d_navigationLabelPartialBlendOutInst;
151 
152  CEGUI::AnimationInstance* d_naviPartialBlendOutInst;
153  CEGUI::AnimationInstance* d_naviBlendInInst;
154  CEGUI::AnimationInstance* d_centerButtonsPartialBlendOutInst;
155  CEGUI::AnimationInstance* d_centerButtonsBlendInInst;
156 
157  CEGUI::AnimationInstance* d_botBarLabelBlendOutInst;
158 
159  CEGUI::AnimationInstance* d_popupLinesSaveAnimInst;
160  CEGUI::AnimationInstance* d_popupLinesLoadAnimInst;
161  CEGUI::AnimationInstance* d_popupLinesCharactersAnimInst;
162  CEGUI::AnimationInstance* d_popupLinesOptionsAnimInst;
163  CEGUI::AnimationInstance* d_popupLinesQuitAnimInst;
164 
165  CEGUI::Window* d_topBarLabel;
166  CEGUI::Window* d_botBarLabel;
167  CEGUI::Window* d_loginContainer;
168  CEGUI::Window* d_botNaviLeftArrowArea;
169  CEGUI::Window* d_botNaviRightArrowArea;
170  CEGUI::Window* d_botNaviCenter;
171  CEGUI::Window* d_loginAcceptButton;
172  CEGUI::Window* d_startButtonClickArea;
173  CEGUI::Window* d_navigationTravelIcon;
174  CEGUI::Window* d_navigationSelectionIcon;
175  CEGUI::Window* d_botNaviContainer;
176 
177 
178 
179 };
180 
181 #endif
Definition: cegui/include/CEGUI/GUIContext.h:68
Main namespace for Crazy Eddie's GUI Library.
Definition: cegui/include/CEGUI/Affector.h:42
Base class used as the argument to all subscribers Event object.
Definition: cegui/include/CEGUI/EventArgs.h:49
Definition: GameMenu.h:47
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: cegui/include/CEGUI/Window.h:149
Defines an 'animation instance' class.
Definition: cegui/include/CEGUI/AnimationInstance.h:73
String class used within the GUI system.
Definition: cegui/include/CEGUI/String.h:62
Definition: Sample.h:36