]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Engine.cc
more featureful sound class
[chaz/yoink] / src / Moof / Engine.cc
index c74ace8ef2207428f360dc5ae397d663539aca28..51a3af0f5bfb6d75d71cdaed34cb7bdd9518c3ac 100644 (file)
@@ -27,7 +27,6 @@
 *******************************************************************************/
 
 #include <cstdlib>                     // exit
-#include <iostream>
 #include <string>
 
 #include <SDL/SDL.h>
@@ -35,7 +34,9 @@
 #include <SDL/SDL_sound.h>
 #include <AL/alut.h>
 
+#include "Dispatcher.hh"
 #include "Engine.hh"
+#include "Log.hh"
 #include "Random.hh"
 #include "Settings.hh"
 #include "Timer.hh"
@@ -53,20 +54,23 @@ public:
                        Engine* outer) :
                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
                {
-                       std::cerr << "sdl is complaining: " << SDL_GetError() << std::endl;
+                       logError("sdl is complaining: %s", SDL_GetError());
                        throw Exception(Exception::SDL_ERROR);
                }
                if (FE_Init() != 0)
                {
-                       std::cerr << "fast events error: " << FE_GetError() << std::endl;
+                       logError("fast events error: %s", FE_GetError());
                        throw Exception(Exception::SDL_ERROR);
                }
                if (Sound_Init() == 0)
                {
-                       std::cerr << "sound initialization failed: " << Sound_GetError()
-                               << std::endl;
+                       logError("sound initialization failed: %s", Sound_GetError());
                        throw Exception(Exception::SDL_ERROR);
                }
                alutInit(&argc, argv);
@@ -90,7 +94,7 @@ public:
                printFps = false;
                settings.get("video.printfps", printFps);
 
-               video = VideoPtr(new Video(name, iconFile));
+               video = Video::alloc(name, iconFile);
                video->makeActive();
        }
 
@@ -170,7 +174,7 @@ public:
 
                                        if (printFps)
                                        {
-                                               std::cout << "FPS: " << fps << std::endl;
+                                               logInfo("framerate: %d fps", fps);
                                        }
                                }
 
@@ -222,7 +226,7 @@ public:
 
        Engine*         interface;
 
-       VideoPtr        video;
+       VideoP          video;
 
        bool            running;
        int                     exitCode;
This page took 0.020341 seconds and 4 git commands to generate.