#include <SDL/SDL_sound.h>
#include <AL/alut.h>
-#include "Dispatcher.hh"
#include "Engine.hh"
#include "Random.hh"
#include "Settings.hh"
Impl(int argc, char* argv[], const std::string& configFile,
const std::string& name, const std::string& iconFile,
Engine* outer) :
- interface(outer),
- settings(argc, argv)
+ interface(outer)
{
+#if defined(_WIN32) || defined (_WIN64) || defined(__WIN32__)
+ if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
+#else
if (SDL_Init(SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD) != 0)
+#endif
{
- throw Exception(SDL_GetError());
+ std::cerr << "sdl is complaining: " << SDL_GetError() << std::endl;
+ throw Exception(Exception::SDL_ERROR);
}
if (FE_Init() != 0)
{
- throw Exception(FE_GetError());
+ std::cerr << "fast events error: " << FE_GetError() << std::endl;
+ throw Exception(Exception::SDL_ERROR);
}
- if (Sound_Init() != 0)
+ if (Sound_Init() == 0)
{
- //throw Exception(Sound_GetError());
- std::cerr << Sound_GetError() << std::endl;
+ std::cerr << "sound initialization failed: " << Sound_GetError()
+ << std::endl;
+ throw Exception(Exception::SDL_ERROR);
}
alutInit(&argc, argv);
+ Settings& settings = Settings::getInstance();
+ settings.parseArgs(argc, argv);
settings.loadFromFile(configFile);
long randomSeed;
printFps = false;
settings.get("video.printfps", printFps);
- video = VideoPtr(new Video(name, iconFile));
+ video = Video::alloc(name, iconFile);
video->makeActive();
}
Engine* interface;
- Settings settings;
- Dispatcher dispatcher;
- VideoPtr video;
+ VideoP video;
bool running;
int exitCode;