clooneljump/src/main.cpp

41 lines
1.2 KiB
C++
Raw Normal View History

2014-01-09 23:04:39 +00:00
#include "CloonelJumpConfig.h"
2014-02-08 22:11:26 +00:00
#include "sdlmain.hpp"
#include "game.hpp"
2014-02-08 22:11:26 +00:00
#include <iostream>
2014-01-09 23:04:39 +00:00
#include <stdexcept>
namespace {
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
void RunMainLoop (cloonel::Game& parGame) {
float totalElapsed = 0.0f;
do {
const float delta = parGame.Exec();
totalElapsed += delta;
} while (totalElapsed < 15.0f);
}
} //unnamed namespace
///----------------------------------------------------------------------------
///following http://twinklebeardev.blogspot.co.uk/2012/07/lesson-1-hello-world.html
///----------------------------------------------------------------------------
2014-01-09 23:04:39 +00:00
int main() {
std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;
2014-02-08 22:11:26 +00:00
cloonel::SDLMain sdlmain(GameName, DEF_WIN_WIDTH, DEF_WIN_HEIGHT);
2014-01-09 23:04:39 +00:00
try {
2014-02-08 22:11:26 +00:00
sdlmain.Init();
2014-01-09 23:04:39 +00:00
}
catch (const std::runtime_error& e) {
std::cerr << "Error during SDL2 initialization:\n";
std::cerr << e.what() << std::endl;
}
cloonel::Game game(&sdlmain);
game.Prepare();
RunMainLoop(game);
2014-01-09 23:04:39 +00:00
std::cout << "Quitting now" << std::endl;
return 0;
}