Support resizing of widgets with OpenGL content.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6945 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
cab53fcbfb
commit
6b641069df
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue