[client] allow window resize event's before startup

This commit is contained in:
Geoffrey McRae
2018-07-19 23:32:42 +10:00
parent 9f8c20c3e7
commit eb6ee8ea46
3 changed files with 41 additions and 31 deletions

View File

@@ -221,7 +221,9 @@ void opengl_on_resize(void * opaque, const int width, const int height, const LG
this->window.x = width;
this->window.y = height;
memcpy(&this->destRect, &destRect, sizeof(LG_RendererRect));
if (destRect.valid)
memcpy(&this->destRect, &destRect, sizeof(LG_RendererRect));
this->resizeWindow = true;
}
@@ -407,12 +409,16 @@ bool opengl_render(void * opaque, SDL_Window * window)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(this->destRect.x, this->destRect.y, 0.0f);
glScalef(
(float)this->destRect.w / (float)this->format.width,
(float)this->destRect.h / (float)this->format.height,
1.0f
);
if (this->destRect.valid)
{
glTranslatef(this->destRect.x, this->destRect.y, 0.0f);
glScalef(
(float)this->destRect.w / (float)this->format.width,
(float)this->destRect.h / (float)this->format.height,
1.0f
);
}
this->resizeWindow = false;
}