1 /* 2 Copyright © 2011-2012 Clint Bellanger 3 Copyright © 2012 Igor Paliychuk 4 Copyright © 2012-2015 Justin Jacobs 5 6 This file is part of FLARE. 7 8 FLARE is free software: you can redistribute it and/or modify it under the terms 9 of the GNU General Public License as published by the Free Software Foundation, 10 either version 3 of the License, or (at your option) any later version. 11 12 FLARE is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along with 17 FLARE. If not, see http://www.gnu.org/licenses/ 18 */ 19 20 #ifndef GAME_SWITCHER_H 21 #define GAME_SWITCHER_H 22 23 #include "CommonIncludes.h" 24 #include "Utils.h" 25 26 class GameState; 27 class WidgetLabel; 28 /** 29 * class GameSwitcher 30 * 31 * State machine handler between main game modes that take up the entire view/control 32 * 33 * Examples: 34 * - the main gameplay (GameStatePlay) 35 * - title screen (GameStateTitle) 36 * - new game screen (GameStateNew) 37 * - load game screen (GameStateLoad) 38 * - cutscenes (GameStateCutscene) 39 */ 40 41 class GameSwitcher { 42 private: 43 void loadBackgroundList(); 44 void refreshBackground(); 45 void freeBackground(); 46 47 GameState *currentState; 48 49 WidgetLabel *label_fps; 50 Rect fps_position; 51 Color fps_color; 52 int fps_corner; 53 54 Sprite *background; 55 Image *background_image; 56 std::string background_filename; 57 std::vector<std::string> background_list; 58 59 Timer fps_update; 60 float last_fps; 61 62 public: 63 GameSwitcher(); 64 GameSwitcher(const GameSwitcher ©); // not implemented. 65 ~GameSwitcher(); 66 67 void loadMusic(); 68 void loadBackgroundImage(); 69 void loadFPS(); 70 bool isLoadingFrame(); 71 bool isPaused(); 72 void logic(); 73 void render(); 74 void showFPS(float fps); 75 void saveUserSettings(); 76 bool done; 77 }; 78 79 #endif 80 81