// $Id: gamemanager.h,v 1.6 2006/08/28 15:23:14 matthew Exp $ // Fish Supper // Copyright (C) 2006 Matthew Clarke // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #ifndef _GAMEMANAGER_H_ #define _GAMEMANAGER_H_ #include "SDL.h" #include "gametimer.h" #include "titlescreendisplay.h" #include "playmodel.h" #include "getreadydisplay.h" #include "playdisplay.h" #include "enums.h" #include "soundengine.h" #include "highscoresdisplay.h" #include "settings.h" #include "settingsdisplay.h" #include "pausemenu.h" namespace FS { class GameManager { public: enum State { INTRO, SELECTING_START_LEVEL, GET_READY, PLAY, SETTINGS, HI_SCORES, ENTERING_NAME }; static const int MAX_EVENTS = 10; private: GameTimer timer; FS::TitleScreenDisplay ts_display; FS::PlayModel p_model; FS::GetReadyDisplay gr_display; FS::PlayDisplay p_display; SoundEngine snd_engine; HighScoresDisplay hs_display; Settings my_settings; SettingsDisplay s_display; PauseMenu my_pause_menu; State current_state; SDL_Surface * screen; KeyboardEvent my_key_event; KeyboardEvent my_key_events[MAX_EVENTS]; int num_key_events; // These are used when ENTERING_NAME. SDL_keysym my_key_downs[MAX_EVENTS]; int num_key_downs; void analyse_event(const SDL_Event * event); void handle_selection(TitleScreenDisplay::Selection sel); bool loop_running; // This is used when ENTERING_NAME. If no key was pressed we // don't bother to call input()... bool key_down; // Needed so that joystick events can emulate keyboard ones. KeyboardEvent last_horizontal; KeyboardEvent last_vertical; bool pause_menu_needs_erasing; public: GameManager(SDL_Surface * s); ~GameManager(); void start_loop(); }; // class GameManager } // namespace FS #endif