/* server/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 "server/server.h" #include "server/application.h" #include "server/timer.h" #include "core/core.h" #include "game/game.h" namespace server { void Application::init() { // FIXME core should be able to load game.so // force initialization of the game object server::game = new game::Game(); con_print << "Initializing server..." << std::endl; // initialize core core::ApplicationInterface::init(); // connect to the game module core::ApplicationInterface::connect(); } void Application::run() { const float server_framerate = 1.0f / 20.0f; server::Timer timer; timer.mark(); while(true) { float elapsed = timer.elapsed(); frame(elapsed); sys::sleep(server_framerate - elapsed); timer.mark(); } } void Application::shutdown() { con_debug << "Shutting down server..." << std::endl; core::ApplicationInterface::shutdown(); quit(0); } void Application::quit(int status) { // FIXME core should be able to unload game.so delete server::game; core::ApplicationInterface::quit(status); } }