X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.cc;h=50711c744c9758cd1a15e965b6166582a5ec35b9;hp=56e98b926bf6fed2f6fe7edadfd8c742b4339659;hb=a295f8def17036c8071b56e181364f99a377cae7;hpb=b357615aba1dbde81e3c6999366604e6001010a7 diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index 56e98b9..50711c7 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -39,7 +39,6 @@ #include "Engine.hh" #include "Event.hh" -#include "Exception.hh" #include "Log.hh" #include "Math.hh" #include "Settings.hh" @@ -53,8 +52,8 @@ class Engine::Impl { public: - Impl(Engine& engine) : - mInterface(engine), + Impl() : + mError(Error::NONE), mTimestep(0.01), mPrintFps(false) { @@ -67,7 +66,8 @@ public: #endif { const char* error = SDL_GetError(); - throw Exception(ErrorCode::SDL_INIT, error); + mError.init(Error::SDL_INIT, error); + //throw Exception(Error::SDL_INIT, error); } else { @@ -80,7 +80,8 @@ public: if (FE_Init() != 0) { const char* error = FE_GetError(); - throw Exception(ErrorCode::FASTEVENTS_INIT, error); + mError.init(Error::FASTEVENTS_INIT, error); + //throw Exception(Error::FASTEVENTS_INIT, error); } mAlDevice = alcOpenDevice(0); @@ -255,7 +256,7 @@ public: { for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) { - (*mStackIt)->update(mInterface, t, dt); + (*mStackIt)->update(t, dt); } } @@ -265,7 +266,7 @@ public: std::list::reverse_iterator it; for (it = mStack.rbegin(); it != mStack.rend(); ++it) { - (*it)->draw(mInterface, alpha); + (*it)->draw(alpha); } } @@ -273,7 +274,7 @@ public: { for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) { - if ((*mStackIt)->handleEvent(mInterface, event)) break; + if ((*mStackIt)->handleEvent(event)) break; } } @@ -284,7 +285,7 @@ public: mStack.push_front(layer); logInfo << "stack: " << mStack.size() << " [pushed " << layer.get() << "]" << std::endl; - layer->pushed(mInterface); + layer->pushedOntoEngine(); } LayerP pop() @@ -296,7 +297,7 @@ public: mStack.pop_front(); logInfo << "stack: " << mStack.size() << " [popped " << layer.get() << "]" << std::endl; - layer->popped(mInterface); + layer->poppedFromEngine(); if (fixIt) mStackIt = --mStack.begin(); @@ -323,7 +324,7 @@ public: for (it = layers.begin(); it != layers.end(); ++it) { - (*it)->popped(mInterface); + (*it)->poppedFromEngine(); logInfo << "stack: " << mStack.size() << " [popped " << (*it).get() << "]" << std::endl; } @@ -356,7 +357,8 @@ public: } - Engine& mInterface; + Error mError; + VideoP mVideo; Dispatch mDispatch; @@ -376,12 +378,13 @@ public: Engine::Engine() : // pass through - mImpl(new Engine::Impl(*this)) {} + mImpl(new Engine::Impl) {} + -Engine& Engine::getInstance() +const Error& Engine::getError() const { - static Engine engine; - return engine; + // pass through + return mImpl->mError; } @@ -483,6 +486,9 @@ void Engine::dispatch(const std::string& event, } +Engine engine; + + } // namespace Mf /** vim: set ts=4 sw=4 tw=80: *************************************************/