X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.cc;h=fca5e15423ee1c9b639412deea3f1e380002e6e6;hp=de7c0cba94356afdc190110e97afcef3121cdc73;hb=71bd9dbaf1c1e3c55a9f63392a73865d8aeee7d4;hpb=d11d8c63ab52c7f6eca2815e47cd6401e72f2c8c diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index de7c0cb..fca5e15 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -27,7 +27,8 @@ *******************************************************************************/ #include -#include // exit +#include // exit, srand +#include // time #include #include @@ -41,7 +42,6 @@ #include "Exception.hh" #include "Log.hh" #include "Math.hh" -#include "Random.hh" #include "Settings.hh" #include "Timer.hh" @@ -69,6 +69,12 @@ public: const char* error = SDL_GetError(); throw Exception(ErrorCode::SDL_INIT, error); } + else + { + char vdName[128]; + SDL_VideoDriverName(vdName, sizeof(vdName)); + logDebug("initialized SDL; using video driver `%s'", vdName); + } if (FE_Init() != 0) { @@ -86,7 +92,7 @@ public: else { alcMakeContextCurrent(mAlContext); - logDebug("opened sound device \"%s\"", + logDebug("opened sound device `%s'", alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER)); } @@ -95,8 +101,8 @@ public: Settings& settings = Settings::getInstance(); unsigned randomSeed; - if (settings.get("rngseed", randomSeed)) setSeed(randomSeed); - else setSeed(); + if (settings.get("rngseed", randomSeed)) srand(randomSeed); + else srand(time(0)); Scalar timestep = 80.0; settings.get("timestep", timestep); @@ -210,6 +216,8 @@ public: Timer::getNextFire()), Timer::ACTUAL); } while (!mStack.empty()); + + mDispatch.dispatch("engine.stopping"); } void dispatchEvents()