2014-01-09 23:04:39 +00:00
|
|
|
#include "CloonelJumpConfig.h"
|
2014-02-08 22:11:26 +00:00
|
|
|
#include "sdlmain.hpp"
|
2014-02-12 23:01:29 +00:00
|
|
|
#include "physicsfswrapper.hpp"
|
2014-02-21 20:28:34 +00:00
|
|
|
#include "gameplaysceneclassic.hpp"
|
2014-02-08 22:11:26 +00:00
|
|
|
#include <iostream>
|
2014-01-09 23:04:39 +00:00
|
|
|
#include <stdexcept>
|
2014-02-09 20:15:43 +00:00
|
|
|
#include <ciso646>
|
2014-01-09 23:04:39 +00:00
|
|
|
|
2014-02-09 00:19:40 +00:00
|
|
|
namespace {
|
|
|
|
///-------------------------------------------------------------------------
|
|
|
|
///-------------------------------------------------------------------------
|
2014-02-21 20:28:34 +00:00
|
|
|
void RunMainLoop (cloonel::GameplaySceneClassic& parGame) {
|
2014-02-09 00:19:40 +00:00
|
|
|
do {
|
2014-02-21 20:28:34 +00:00
|
|
|
parGame.Exec();
|
2014-02-09 20:15:43 +00:00
|
|
|
} while (not parGame.WantsToQuit());
|
2014-02-09 00:19:40 +00:00
|
|
|
}
|
|
|
|
} //unnamed namespace
|
|
|
|
|
2014-02-08 19:25:30 +00:00
|
|
|
///----------------------------------------------------------------------------
|
|
|
|
///following http://twinklebeardev.blogspot.co.uk/2012/07/lesson-1-hello-world.html
|
|
|
|
///----------------------------------------------------------------------------
|
2014-02-21 20:28:34 +00:00
|
|
|
int main (int, char* []) {
|
2014-01-09 23:04:39 +00:00
|
|
|
std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;
|
|
|
|
|
2014-02-12 23:01:29 +00:00
|
|
|
int retVal = 0;
|
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-12 23:01:29 +00:00
|
|
|
#if defined(NDEBUG)
|
|
|
|
cloonel::PhysicsFSWrapper physfs(parArgc[0]);
|
|
|
|
#else
|
|
|
|
cloonel::PhysicsFSWrapper physfs(GAME_BASE_PATH);
|
|
|
|
#endif
|
|
|
|
physfs.Append("resources", "resources");
|
|
|
|
|
2014-02-08 22:11:26 +00:00
|
|
|
sdlmain.Init();
|
2014-02-12 23:01:29 +00:00
|
|
|
|
2014-02-21 20:28:34 +00:00
|
|
|
cloonel::GameplaySceneClassic game(&sdlmain);
|
2014-02-12 23:01:29 +00:00
|
|
|
RunMainLoop(game);
|
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-12 23:01:29 +00:00
|
|
|
retVal = 1;
|
2014-01-09 23:04:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "Quitting now" << std::endl;
|
2014-02-12 23:01:29 +00:00
|
|
|
return retVal;
|
2014-01-09 23:04:39 +00:00
|
|
|
}
|