ScummVM API documentation
application.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_GAME_APPLICATION_H
23 #define TETRAEDGE_GAME_APPLICATION_H
24 
25 #include "common/str.h"
26 #include "common/ptr.h"
27 
28 #include "tetraedge/game/bonus_menu.h"
29 #include "tetraedge/game/credits.h"
30 #include "tetraedge/game/global_bonus_menu.h"
31 #include "tetraedge/game/main_menu.h"
32 #include "tetraedge/game/options_menu.h"
33 #include "tetraedge/game/loc_file.h"
34 #include "tetraedge/game/owner_error_menu.h"
35 #include "tetraedge/game/splash_screens.h"
36 #include "tetraedge/game/in_game_scene.h"
37 #include "tetraedge/game/upsell_screen.h"
38 
39 #include "tetraedge/te/te_visual_fade.h"
40 #include "tetraedge/te/te_music.h"
41 #include "tetraedge/te/te_xml_gui.h"
42 #include "tetraedge/te/te_font3.h"
43 
44 namespace Common {
45 struct Event;
46 }
47 
48 namespace Tetraedge {
49 
50 class Application {
51 public:
52  Application();
53  ~Application();
54 
55  void create();
56  void destroy();
57 
58  void startGame(bool newGame, int difficulty);
59  void resume();
60  bool run();
61  void suspend();
62  void showNoCellIcon(bool show);
63  void showLoadingIcon(bool show);
64  void saveCorrupted(const Common::String &fname);
65 
66  void performRender();
67  //void preloadTextrue(); does nothing
68 
69  void fade();
70  void blackFade();
71  void captureFade();
72  bool isFading();
73 
74  bool isLockCursor();
75  bool isLockPad();
76  void lockCursor(bool lock);
77  void lockCursorFromAction(bool lock);
78 
79  void loadOptions(const Common::String &fname);
80  void saveOptions(const Common::String &fname);
81 
82  void getSavegameThumbnail(Graphics::Surface &thumb);
83 
84  Common::String getHelpText(const Common::String &key);
85 
86  BonusMenu &bonusMenu() { return _bonusMenu; }
87  GlobalBonusMenu &globalBonusMenu() { return _globalBonusMenu; }
88  MainMenu &mainMenu() { return _mainMenu; }
89  OptionsMenu &optionsMenu() { return _optionsMenu; }
90  TeMusic &music() { return _music; }
91  Credits &credits() { return _credits; }
92  UpsellScreen &upsellScreen() { return _upsellScreen; }
93  TeVisualFade &visualFade() { return _visFade; }
94  TeSpriteLayout &appSpriteLayout() { return _appSpriteLayout; }
95  TeSpriteLayout &mouseCursorLayout() { return _mouseCursorLayout; }
96  const Common::String getVersionString() const { return _versionString; }
97  TeLayout &getMainWindow() { return _mainWindow; }
98  void setTutoActivated(bool val) { _tutoActivated = val; }
99  TeCamera *mainWindowCamera() { return _mainWindowCamera.get(); }
100  Common::Array<Common::String> &unrecalAnims() { return _unrecalAnims; }
101  int &difficulty() { return _difficulty; }
102  bool &tutoActivated() { return _tutoActivated; }
103 
104  void setFinishedGame(bool val) { _finishedGame = val; }
105  void setFinishedFremium(bool val) { _finishedFremium = val; }
106  const Common::String &firstWarpPath() { return _firstWarpPath; }
107  const Common::String &firstZone() { return _firstZone; }
108  const Common::String &firstScene() { return _firstScene; }
109  const Common::Path &defaultCursor() { return _defaultCursor; }
110  TeLayout &frontLayout() { return _frontLayout; };
111  TeLayout &frontOrientationLayout() { return _frontOrientationLayout; }
112  TeLayout &backLayout() { return _backLayout; }
113  LocFile &loc() { return _loc; }
114  bool ratioStretched() const { return _ratioStretched; }
115  bool compassLook() const { return _compassLook; }
116  bool inverseLook() const { return _inverseLook; }
117  bool permanentHelp() const { return _permanentHelp; }
118  bool musicOn() const { return _musicOn; }
119 
120 private:
121  void drawBack();
122  void drawFront();
123 
124  const char *inAppUnlockFullVersionID();
125 
126  bool onBlackFadeAnimationFinished();
127  bool onMainWindowSizeChanged();
128  bool onMousePositionChanged(const Common::Point &p);
129 
130  bool _finishedGame;
131  bool _finishedFremium;
132 
133  TeVisualFade _visFade;
134  TeMusic _music;
135  TeSpriteLayout _appSpriteLayout;
136  TeSpriteLayout _mouseCursorLayout;
137  TeSpriteLayout _autoSaveIcon1;
138  TeSpriteLayout _autoSaveIcon2;
139 
140  TeButtonLayout _lockCursorButton;
141  TeButtonLayout _lockCursorFromActionButton;
142 
143  TeLayout _frontLayout;
144  TeLayout _frontOrientationLayout;
145  TeLayout _backLayout;
146 
147  LocFile _loc;
148 
149  Common::String _applicationTitle;
150  Common::String _versionString;
151  Common::String _firstWarpPath;
152  Common::String _firstZone;
153  Common::String _firstScene;
154  Common::Path _defaultCursor;
155 
156  Common::Array<Common::String> _unrecalAnims;
157 
158  TeCurveAnim2<Te3DObject2, TeColor> _autoSaveIconAnim1;
159  TeCurveAnim2<Te3DObject2, TeColor> _autoSaveIconAnim2;
160 
161  Common::SharedPtr<TeCamera> _mainWindowCamera; // TODO: should be part of TeMainWindow.
162  TeLayout _mainWindow; // TODO: should be a specialised class.
163 
164  GlobalBonusMenu _globalBonusMenu;
165  BonusMenu _bonusMenu;
166  MainMenu _mainMenu;
167  OptionsMenu _optionsMenu;
168  Credits _credits;
169  OwnerErrorMenu _ownerErrorMenu;
170  SplashScreens _splashScreens;
171  UpsellScreen _upsellScreen;
172 
173  TeIntrusivePtr<TeFont3> _fontComic;
174  TeIntrusivePtr<TeFont3> _fontArgh;
175  TeIntrusivePtr<TeFont3> _fontArial;
176  TeIntrusivePtr<TeFont3> _fontChaucer;
177  TeIntrusivePtr<TeFont3> _fontColaborate;
178  TeIntrusivePtr<TeFont3> _fontProDisplay;
179 
180  bool _captureFade;
181  bool _created;
182  bool _tutoActivated;
183  bool _drawShadows;
184  bool _ratioStretched;
185  bool _compassLook;
186  bool _inverseLook;
187  bool _permanentHelp;
188  bool _musicOn;
189 
190  int _difficulty;
191 
192  TeXmlGui _helpGui;
193  static bool _dontUpdateWhenApplicationPaused;
194 };
195 
196 } // end namespace Tetraedge
197 
198 #endif // TETRAEDGE_GAME_APPLICATION_H
Definition: te_camera.h:38
Definition: owner_error_menu.h:29
Definition: credits.h:32
Definition: str.h:59
Definition: detection.h:27
Definition: surface.h:67
Definition: path.h:52
Definition: global_bonus_menu.h:29
Definition: te_curve_anim2.h:36
Definition: te_button_layout.h:38
Definition: te_visual_fade.h:34
Definition: application.h:50
Definition: algorithm.h:29
Definition: te_layout.h:35
Definition: main_menu.h:31
Definition: rect.h:45
Definition: upsell_screen.h:29
Definition: te_xml_gui.h:34
Definition: te_intrusive_ptr.h:31
Definition: options_menu.h:30
Definition: ptr.h:159
Definition: te_music.h:35
Definition: bonus_menu.h:33
Definition: splash_screens.h:30
Definition: te_sprite_layout.h:30
Definition: loc_file.h:32