forked from mirror/openmw-tes3mp
fixes a bug when resizing the window before a window listener is set
This commit is contained in:
parent
adab85eeb7
commit
512ee1204e
2 changed files with 24 additions and 2 deletions
|
@ -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…
Reference in a new issue