/* main.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 */ // SDL headers #include // C++ headers #include // project headers #include "common/osirion.h" #include "game/game.h" #include "input.h" #include "video.h" void quit(int exit_code) { SDL_Quit(); exit(exit_code); } int main( int argc, char *argv[] ) { std::cout << "The Osirion project " << OSIRION_VERSION << std::endl; // Initialize the video subsystem video::init(); if (!video::initialized) { quit(1); } // initialize input input::init(); // initialize game game::init(); Uint32 startup = SDL_GetTicks(); while(game::initialized) { Uint32 chrono = SDL_GetTicks(); // overflow protection ~49 days if (chrono < startup) { startup = chrono; } // update the game chronometers float elapsed = (float) ( chrono - startup) / 1000.0f; game::update(elapsed); // update the video chronometers and draw video::draw(elapsed); startup = chrono; // process input input::process(); } video::shutdown(); quit(0); }