From 803f188895d6a4036f0e5eaed36f7822c70a3a90 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 15 Sep 2008 04:34:46 +0000 Subject: [PATCH] 1) Renamed game_manager to main_loop. 2) Cleaned up some include files. 3) Fixed compilation of optimised version on VS. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2271 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/Makefile.am | 2 +- src/gui/grand_prix_ending.cpp | 1 - src/gui/menu_manager.cpp | 4 ++-- src/ide/vc9/supertuxkart.vcproj | 20 ++++++++++---------- src/main.cpp | 8 ++++---- src/{game_manager.cpp => main_loop.cpp} | 25 ++++++++++++++----------- src/{game_manager.hpp => main_loop.hpp} | 16 ++++++++-------- src/race_manager.cpp | 1 - src/sdldrv.cpp | 4 ++-- 9 files changed, 41 insertions(+), 40 deletions(-) rename src/{game_manager.cpp => main_loop.cpp} (95%) rename src/{game_manager.hpp => main_loop.hpp} (83%) diff --git a/src/Makefile.am b/src/Makefile.am index 667c17c64..8470ed79a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,7 +85,7 @@ supertuxkart_SOURCES = main.cpp \ skid_mark.cpp skid_mark.hpp \ shadow.cpp shadow.hpp \ particle_system.cpp particle_system.hpp \ - game_manager.cpp game_manager.hpp \ + main_loop.cpp main_loop.hpp \ camera.cpp camera.hpp \ sdldrv.cpp sdldrv.hpp \ moveable.cpp moveable.hpp \ diff --git a/src/gui/grand_prix_ending.cpp b/src/gui/grand_prix_ending.cpp index 8da6b6843..1d9819631 100644 --- a/src/gui/grand_prix_ending.cpp +++ b/src/gui/grand_prix_ending.cpp @@ -29,7 +29,6 @@ #include "unlock_manager.hpp" #include "widget_manager.hpp" #include "race_manager.hpp" -#include "game_manager.hpp" #include "user_config.hpp" #include "menu_manager.hpp" #include "kart_properties.hpp" diff --git a/src/gui/menu_manager.cpp b/src/gui/menu_manager.cpp index be1a4c222..6d8e9452f 100644 --- a/src/gui/menu_manager.cpp +++ b/src/gui/menu_manager.cpp @@ -39,7 +39,7 @@ #include "race_results_gui.hpp" #include "grand_prix_ending.hpp" #include "race_manager.hpp" -#include "game_manager.hpp" +#include "main_loop.hpp" #include "race_menu.hpp" #include "help_page_one.hpp" #include "help_page_two.hpp" @@ -200,7 +200,7 @@ void MenuManager::update() break; case MENUID_EXITGAME: m_menu_stack.clear(); - game_manager->abort(); + main_loop->abort(); break; case MENUID_CONFIG_CONTROLS: diff --git a/src/ide/vc9/supertuxkart.vcproj b/src/ide/vc9/supertuxkart.vcproj index d9cb7bdd0..c6c7580d0 100644 --- a/src/ide/vc9/supertuxkart.vcproj +++ b/src/ide/vc9/supertuxkart.vcproj @@ -604,7 +604,7 @@ - - @@ -771,6 +767,10 @@ RelativePath="../../../src\main.cpp" > + + @@ -1193,10 +1193,6 @@ RelativePath="..\..\flyable.hpp" > - - @@ -1265,6 +1261,10 @@ RelativePath="..\..\loader.hpp" > + + diff --git a/src/main.cpp b/src/main.cpp index e0c5b3259..32f1c8768 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,7 +54,7 @@ #include "race_manager.hpp" #include "file_manager.hpp" #include "loader.hpp" -#include "game_manager.hpp" +#include "main_loop.hpp" #include "gui/widget_manager.hpp" #include "material_manager.hpp" #include "sdldrv.hpp" @@ -491,7 +491,7 @@ int main(int argc, char *argv[] ) inputDriver = new SDLDriver (); ssgInit () ; - game_manager = new GameManager (); + main_loop = new MainLoop(); // loadMaterials needs ssgLoadTextures (internally), which can // only be called after ssgInit (since this adds the actual file_manager) // so this next call can't be in InitTuxkart. And InitPlib needs @@ -520,7 +520,7 @@ int main(int argc, char *argv[] ) // This will setup the race manager etc. history->Load(); race_manager->startNew(); - game_manager->run(); + main_loop->run(); // well, actually run() will never return, since // it exits after replaying history (see history::GetNextDT()). // So the next line is just to make this obvious here! @@ -564,7 +564,7 @@ int main(int argc, char *argv[] ) race_manager->setDifficulty(RaceManager::RD_HARD); race_manager->startNew(); } - game_manager->run(); + main_loop->run(); } // try catch (std::exception &e) diff --git a/src/game_manager.cpp b/src/main_loop.cpp similarity index 95% rename from src/game_manager.cpp rename to src/main_loop.cpp index 2d5e368b4..4ac866b84 100644 --- a/src/game_manager.cpp +++ b/src/main_loop.cpp @@ -1,4 +1,4 @@ -// $Id: screen_manager.cpp 855 2006-11-17 01:50:37Z coz $ +// $Id: main_loop.cpp 855 2006-11-17 01:50:37Z coz $ // // SuperTuxKart - a fun racing game with go-kart // Copyright (C) 2004 Ingo Ruhnke @@ -17,7 +17,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -//#include +#include "main_loop.hpp" #ifdef __APPLE__ # include @@ -31,7 +31,6 @@ #include #include #include "sdldrv.hpp" -#include "game_manager.hpp" #include "gui/menu_manager.hpp" #include "sound_manager.hpp" #include "material_manager.hpp" @@ -42,23 +41,25 @@ #include "history.hpp" #include "network/network_manager.hpp" -GameManager* game_manager = 0; +MainLoop* main_loop = 0; -GameManager::GameManager() : +MainLoop::MainLoop() : m_abort(false), m_frame_count(0), m_curr_time(m_prev_time), m_prev_time(SDL_GetTicks()) { -} // GameManager +} // MainLoop //----------------------------------------------------------------------------- -GameManager::~GameManager() +MainLoop::~MainLoop() { -} // ~GameManager +} // ~MainLoop //----------------------------------------------------------------------------- -void GameManager::run() +/** Run the actual main loop. + */ +void MainLoop::run() { const GLuint TITLE_SCREEN_TEXTURE = material_manager->getMaterial("st_title_screen.rgb")->getState()->getTextureHandle(); @@ -192,9 +193,11 @@ void GameManager::run() } // run //----------------------------------------------------------------------------- -void GameManager::abort() +/** Set the abort flag, causing the mainloop to be left. + */ +void MainLoop::abort() { m_abort = true; -} +} // abort /* EOF */ diff --git a/src/game_manager.hpp b/src/main_loop.hpp similarity index 83% rename from src/game_manager.hpp rename to src/main_loop.hpp index 3f7dee8da..302e4e4db 100644 --- a/src/game_manager.hpp +++ b/src/main_loop.hpp @@ -1,4 +1,4 @@ -// $Id: screen_manager.hpp 855 2006-11-17 01:50:37Z coz $ +// $Id: main_loop.hpp 855 2006-11-17 01:50:37Z coz $ // // SuperTuxKart - a fun racing game with go-kart // Copyright (C) 2004 Ingo Ruhnke @@ -17,13 +17,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef HEADER_SCREENMANAGER_H -#define HEADER_SCREENMANAGER_H +#ifndef HEADER_MAIN_LOOP_HPP +#define HEADER_MAIN_LOOP_HPP #include /** Management class for the whole gameflow, this is where the main-loop is */ -class GameManager +class MainLoop { private: bool m_abort; @@ -33,13 +33,13 @@ private: Uint32 m_prev_time; public: - GameManager(); - ~GameManager(); + MainLoop(); + ~MainLoop(); void run(); void abort(); -}; +}; // MainLoop -extern GameManager* game_manager; +extern MainLoop* main_loop; #endif diff --git a/src/race_manager.cpp b/src/race_manager.cpp index a706e9783..1ad22100d 100644 --- a/src/race_manager.cpp +++ b/src/race_manager.cpp @@ -22,7 +22,6 @@ #include #include "track_manager.hpp" -#include "game_manager.hpp" #include "kart_properties_manager.hpp" #include "unlock_manager.hpp" #include "gui/menu_manager.hpp" diff --git a/src/sdldrv.cpp b/src/sdldrv.cpp index 9401ba529..de3e12a3c 100755 --- a/src/sdldrv.cpp +++ b/src/sdldrv.cpp @@ -31,7 +31,7 @@ #include "sdldrv.hpp" #include "material_manager.hpp" #include "kart_properties_manager.hpp" -#include "game_manager.hpp" +#include "main_loop.hpp" #include "herring_manager.hpp" #include "collectable_manager.hpp" #include "attachment_manager.hpp" @@ -387,7 +387,7 @@ SDLDriver::input() switch(ev.type) { case SDL_QUIT: - game_manager->abort(); + main_loop->abort(); break; case SDL_KEYUP: