diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-01 19:34:47 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-01 19:34:47 +0000 |
commit | 6c8446cddb37df732fc9e5fc21f98e31968ce634 (patch) | |
tree | 25515ae78969e2f0ef216a5cbef8a650b217e8f8 /src/client/client.cc | |
parent | f794b9ee52293cefd6ac73fdf0d2a01c5388f057 (diff) |
interface cleanup
Diffstat (limited to 'src/client/client.cc')
-rw-r--r-- | src/client/client.cc | 96 |
1 files changed, 15 insertions, 81 deletions
diff --git a/src/client/client.cc b/src/client/client.cc index 7a718a3..e78f73d 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -4,91 +4,25 @@ the terms and conditions of the GNU General Public License version 2 */ -// project headers -#include "client/client.h" -#include "game/game.h" -#include "core/core.h" -#include "common/common.h" - -// SDL headers -#include <SDL/SDL.h> +#include "client/application.h" +#include "client/camera.h" +#include "client/console.h" +#include "client/input.h" +#include "client/video.h" +#include "client/view.h" -// C++ headers -#include <cmath> +#include "game/game.h" namespace client { // public instances -Camera camera; -View view; -Video video; -Input input; - -// private instance of the client console object -Console console_instance; -// private instance of the game object -game::Game game_instance; - -void quit(int status) -{ - SDL_Quit(); - exit(status); -} - -void init() -{ - // core initializes all the modules - core::init(); - - con_debug << "Initializing client..." << std::endl; - - // Initialize the video subsystem - video.init(); - if (!video.initialized) { - quit(1); - } - - // initialize input - input.init(); -} - -void run() -{ - Uint32 chrono = SDL_GetTicks(); - - while(true) { - Uint32 current = SDL_GetTicks(); - - // overflow protection ~49 days - if (current < chrono) { - chrono = current; - } - - // update the game chronometers - float elapsed = (float) ( current - chrono) / 1000.0f; - chrono = current; - - core::frame(elapsed); - - // update the video chronometers and draw - video.draw(elapsed); - - // process input - input.process(); - } -} - -void shutdown() -{ - con_debug << "Shutting down client..." << std::endl; - - input.shutdown(); - - video.shutdown(); - - core::shutdown(); - - quit(0); -} +Application application; +Camera camera; +View view; +Video video; +Input input; +Console console; +game::Game game; } // namespace client + |