2014-01-09 23:04:39 +00:00
|
|
|
#include "CloonelJumpConfig.h"
|
2014-02-08 22:11:26 +00:00
|
|
|
#include "sdlmain.hpp"
|
2014-02-08 23:32:11 +00:00
|
|
|
#include "game.hpp"
|
2014-02-08 22:11:26 +00:00
|
|
|
#include <iostream>
|
2014-01-09 23:04:39 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
|
2014-02-09 00:19:40 +00:00
|
|
|
namespace {
|
|
|
|
///-------------------------------------------------------------------------
|
|
|
|
///-------------------------------------------------------------------------
|
|
|
|
void RunMainLoop (cloonel::Game& parGame) {
|
|
|
|
float totalElapsed = 0.0f;
|
|
|
|
do {
|
|
|
|
const float delta = parGame.Exec();
|
|
|
|
totalElapsed += delta;
|
|
|
|
} while (totalElapsed < 15.0f);
|
|
|
|
}
|
|
|
|
} //unnamed namespace
|
|
|
|
|
2014-02-08 19:25:30 +00:00
|
|
|
///----------------------------------------------------------------------------
|
|
|
|
///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;
|
|
|
|
}
|
|
|
|
|
2014-02-08 23:32:11 +00:00
|
|
|
cloonel::Game game(&sdlmain);
|
|
|
|
game.Prepare();
|
2014-02-09 00:19:40 +00:00
|
|
|
RunMainLoop(game);
|
2014-02-08 23:32:11 +00:00
|
|
|
|
2014-01-09 23:04:39 +00:00
|
|
|
std::cout << "Quitting now" << std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|