diff options
Diffstat (limited to 'src/client/application.cc')
-rw-r--r-- | src/client/application.cc | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/client/application.cc b/src/client/application.cc deleted file mode 100644 index c8eaab4..0000000 --- a/src/client/application.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* - client/application.cc - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 -*/ - -// project headers -#include "client/client.h" -#include "client/application.h" -#include "core/core.h" - -// SDL headers -#include <SDL/SDL.h> - -// C++ headers -#include <cmath> - -namespace client -{ - -extern "C" void func_con_toggle(std::stringstream &args) -{ - console.toggle(); -} - -void Application::quit(int status) -{ - SDL_Quit(); - core::ApplicationInterface::quit(status); -} - -void Application::init() -{ - con_print << "Initializing client..." << std::endl; - // initialize core - core::ApplicationInterface::init(); - - // Initialize the video subsystem - if (!client::video::init()) - quit(1); - - // initialize input - input::init(); - - // register our engine functions - core::func::add("con_toggle", func_con_toggle); -} - -void Application::run() -{ - con_print << "Running client..." << std::endl; - - Uint32 chrono = SDL_GetTicks(); - - while (true) { - Uint32 current = SDL_GetTicks(); - - // overflow protection ~49 days - if (current < chrono) { - chrono = current; - } - - // run a core frame - float seconds = ((float)(current - chrono)) / 1000.0f; - frame(seconds); - - // run a video frame - video::frame(seconds); - if (seconds > 0) - current_fps = floorf(1/seconds); - else - current_fps = 9999; - - // process input - input::frame(seconds); - - // update the main loop chronometer - chrono = current; - } - -} - -void Application::shutdown() -{ - con_print << "Shutting down client..." << std::endl; - console.flush(); - - input::shutdown(); - console.flush(); - - video::shutdown(); - console.flush(); - - core::ApplicationInterface::shutdown(); - console.flush(); - - quit(0); -} - -} // namespace client - |