Support resizing of widgets with OpenGL content.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6945 4a71c877-e1ca-e34f-864e-861f7616d084
master
Freddie Witherden 2009-04-02 11:24:17 +00:00 committed by Git SVN Gateway
parent cab53fcbfb
commit 6b641069df
2 changed files with 14 additions and 0 deletions

View File

@ -1279,6 +1279,13 @@ void widgetResizeImpl(widget *self, int w, int h)
widgetDrawMask(self);
}
// If OpenGL is enabled disable and re-enable it
if (self->openGLEnabled)
{
widgetDisableGL(self);
widgetEnableGL(self);
}
// Set the needs redraw flag
self->needsRedraw = true;

View File

@ -78,6 +78,11 @@ static void paintWithGL(widget *self)
widgetEndGL(self, false);
}
static bool timer(widget *self, const event *evt, int handlerId, void *userData)
{
widgetResize(self, self->size.x + 100, self->size.y + 100);
}
static void createGUI(lua_State *L)
{
window *w = malloc(sizeof(window));
@ -88,6 +93,8 @@ static void createGUI(lua_State *L)
// GL stuff
widgetEnableGL(WIDGET(w));
WIDGET(w)->vtbl->doDraw = paintWithGL;
widgetAddTimerEventHandler(WIDGET(w), EVT_TIMER_SINGLE_SHOT, 3000,
timer, NULL, NULL);
}
#endif