diff options
Diffstat (limited to 'src/server/application.cc')
-rw-r--r-- | src/server/application.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/server/application.cc b/src/server/application.cc new file mode 100644 index 0000000..b6cd91f --- /dev/null +++ b/src/server/application.cc @@ -0,0 +1,50 @@ +/* + 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" + +namespace server { + +void Application::init() +{ + // initialize core + core::ApplicationInterface::init(); + + con_debug << "Initializing server..." << std::endl; +} + +void Application::run() +{ + const float server_framerate = 1.0f / 20.0f; + server::Timer timer; + + timer.mark(); + + while(true) { + float elapsed = timer.elapsed(); + + frame(elapsed); + + timer.sleep(server_framerate - elapsed); + timer.mark(); + } + +} + +void Application::shutdown() +{ + con_debug << "Shutting down server..." << std::endl; + + core::ApplicationInterface::shutdown(); + + exit(0); +} + +} |