X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.cc;h=de7c0cba94356afdc190110e97afcef3121cdc73;hp=f4bc712b27887d0b5397c579fc861d196ffc3bc6;hb=d11d8c63ab52c7f6eca2815e47cd6401e72f2c8c;hpb=e495074443d9fd7bc16137084cf9de3d031b75c4 diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index f4bc712..de7c0cb 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -31,9 +31,10 @@ #include #include +#include #include #include "fastevents.h" -#include + #include "Engine.hh" #include "Event.hh" @@ -68,15 +69,27 @@ public: const char* error = SDL_GetError(); throw Exception(ErrorCode::SDL_INIT, error); } + if (FE_Init() != 0) { const char* error = FE_GetError(); throw Exception(ErrorCode::FASTEVENTS_INIT, error); } - int argc = 1; - char name[] = "hello"; - alutInit(&argc, (char**)&name); - + + mAlDevice = alcOpenDevice(0); + mAlContext = alcCreateContext(mAlDevice, 0); + if (!mAlDevice || !mAlContext) + { + const char* error = alcGetString(mAlDevice,alcGetError(mAlDevice)); + logError("error while creating audio context: %s", error); + } + else + { + alcMakeContextCurrent(mAlContext); + logDebug("opened sound device \"%s\"", + alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER)); + } + // now load the settings the engine needs Settings& settings = Settings::getInstance(); @@ -102,7 +115,10 @@ public: // the video object must be destroyed before we can shutdown SDL mVideo.reset(); - alutExit(); + alcMakeContextCurrent(0); + alcDestroyContext(mAlContext); + alcCloseDevice(mAlDevice); + FE_Quit(); SDL_Quit(); } @@ -329,6 +345,9 @@ public: VideoP mVideo; Dispatch mDispatch; + ALCdevice* mAlDevice; + ALCcontext* mAlContext; + std::list mStack; std::list::iterator mStackIt;