#include "Engine.hh"
#include "Event.hh"
-#include "Exception.hh"
#include "Log.hh"
#include "Math.hh"
#include "Settings.hh"
{
public:
- Impl(Engine& engine) :
- mInterface(engine),
+ Impl() :
+ mError(Error::NONE),
mTimestep(0.01),
mPrintFps(false)
{
#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
{
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);
{
for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt)
{
- (*mStackIt)->update(mInterface, t, dt);
+ (*mStackIt)->update(t, dt);
}
}
std::list<LayerP>::reverse_iterator it;
for (it = mStack.rbegin(); it != mStack.rend(); ++it)
{
- (*it)->draw(mInterface, alpha);
+ (*it)->draw(alpha);
}
}
{
for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt)
{
- if ((*mStackIt)->handleEvent(mInterface, event)) break;
+ if ((*mStackIt)->handleEvent(event)) break;
}
}
mStack.push_front(layer);
logInfo << "stack: " << mStack.size()
<< " [pushed " << layer.get() << "]" << std::endl;
- layer->pushed(mInterface);
+ layer->pushedOntoEngine();
}
LayerP pop()
mStack.pop_front();
logInfo << "stack: " << mStack.size()
<< " [popped " << layer.get() << "]" << std::endl;
- layer->popped(mInterface);
+ layer->poppedFromEngine();
if (fixIt) mStackIt = --mStack.begin();
for (it = layers.begin(); it != layers.end(); ++it)
{
- (*it)->popped(mInterface);
+ (*it)->poppedFromEngine();
logInfo << "stack: " << mStack.size()
<< " [popped " << (*it).get() << "]" << std::endl;
}
}
- Engine& mInterface;
+ Error mError;
+
VideoP mVideo;
Dispatch mDispatch;
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;
}
}
+Engine engine;
+
+
} // namespace Mf
/** vim: set ts=4 sw=4 tw=80: *************************************************/