fixes a bug when resizing the window before a window listener is set

actorid
Sebastian Wick 11 years ago
parent adab85eeb7
commit 512ee1204e

@ -157,6 +157,21 @@ void OgreRenderer::setFov(float fov)
void OgreRenderer::windowResized(int x, int y)
{
if (mWindowListener)
if (mWindowListener) {
mWindowListener->windowResized(x,y);
}
else {
mWindowWidth = x;
mWindowHeight = y;
mOutstandingResize = true;
}
}
void OgreRenderer::setWindowListener(WindowSizeListener* listener)
{
mWindowListener = listener;
if (mOutstandingResize) {
windowResized(mWindowWidth, mWindowHeight);
mOutstandingResize = false;
}
}

@ -66,6 +66,10 @@ namespace OEngine
WindowSizeListener* mWindowListener;
int mWindowWidth;
int mWindowHeight;
bool mOutstandingResize;
public:
OgreRenderer()
: mRoot(NULL)
@ -77,6 +81,9 @@ namespace OEngine
, mOgreInit(NULL)
, mFader(NULL)
, mWindowListener(NULL)
, mWindowWidth(0)
, mWindowHeight(0)
, mOutstandingResize(false)
{
}
@ -133,7 +140,7 @@ namespace OEngine
/// Viewport
Ogre::Viewport *getViewport() { return mView; }
void setWindowListener(WindowSizeListener* listener) { mWindowListener = listener; }
void setWindowListener(WindowSizeListener* listener);
void adjustViewport();
};

Loading…
Cancel
Save