46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#include "CloonelJumpConfig.h"
|
|
#include "sdlmain.hpp"
|
|
#include "physicsfswrapper.hpp"
|
|
#include "gameplaysceneclassic.hpp"
|
|
#include <iostream>
|
|
#include <stdexcept>
|
|
#include <ciso646>
|
|
|
|
namespace {
|
|
///-------------------------------------------------------------------------
|
|
///-------------------------------------------------------------------------
|
|
void RunMainLoop (cloonel::GameplaySceneClassic& parGame) {
|
|
parGame.Prepare();
|
|
do {
|
|
parGame.Exec();
|
|
} while (not parGame.WantsToQuit());
|
|
parGame.Destroy();
|
|
}
|
|
} //unnamed namespace
|
|
|
|
///----------------------------------------------------------------------------
|
|
///following http://twinklebeardev.blogspot.co.uk/2012/07/lesson-1-hello-world.html
|
|
///----------------------------------------------------------------------------
|
|
int main (int, char* parArgv[]) {
|
|
std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;
|
|
|
|
int retVal = 0;
|
|
cloonel::SDLMain sdlmain(GameName, DEF_WIN_WIDTH, DEF_WIN_HEIGHT);
|
|
try {
|
|
cloonel::PhysicsFSWrapper physfs(parArgv[0]);
|
|
physfs.Append(GAME_BASE_PATH "/resources/", "resources");
|
|
|
|
sdlmain.Init();
|
|
|
|
cloonel::GameplaySceneClassic game(&sdlmain);
|
|
RunMainLoop(game);
|
|
}
|
|
catch (const std::runtime_error& e) {
|
|
std::cerr << "Error during SDL2 initialization:\n";
|
|
std::cerr << e.what() << std::endl;
|
|
retVal = 1;
|
|
}
|
|
|
|
std::cout << "Quitting now" << std::endl;
|
|
return retVal;
|
|
}
|