]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Engine.cc
better logging (maybe) and exception handling
[chaz/yoink] / src / Moof / Engine.cc
index 78233688d60f69dba90c880a0c9e94b9518f0814..c74ace8ef2207428f360dc5ae397d663539aca28 100644 (file)
@@ -35,7 +35,6 @@
 #include <SDL/SDL_sound.h>
 #include <AL/alut.h>
 
-#include "Dispatcher.hh"
 #include "Engine.hh"
 #include "Random.hh"
 #include "Settings.hh"
@@ -52,24 +51,28 @@ public:
        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 (SDL_Init(SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD) != 0)
                {
-                       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;
@@ -219,8 +222,6 @@ public:
 
        Engine*         interface;
 
-       Settings        settings;
-       Dispatcher      dispatcher;
        VideoPtr        video;
 
        bool            running;
This page took 0.022533 seconds and 4 git commands to generate.