Browse Source

Minor cleanup in the editor main code.

legacy
Sam Hocevar sam 14 years ago
parent
commit
b55b3e652b
1 changed files with 14 additions and 18 deletions
  1. +14
    -18
      src/gtk/editor.cpp

+ 14
- 18
src/gtk/editor.cpp View File

@@ -50,18 +50,26 @@ static gboolean tick(void *widget)


static gint init(GtkWidget *widget) static gint init(GtkWidget *widget)
{ {
/* OpenGL functions can be called only if make_current returns true */
if (gtk_gl_area_make_current(GTK_GL_AREA(widget))) if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
{
Video::Setup(widget->allocation.width,
widget->allocation.height);
}
Video::Setup(widget->allocation.width, widget->allocation.height);

return TRUE; return TRUE;
} }


static gint reshape(GtkWidget *widget, GdkEventConfigure *event)
{
(void)event;

return init(widget);
}

static gint draw(GtkWidget *widget, GdkEventExpose *event) static gint draw(GtkWidget *widget, GdkEventExpose *event)
{ {
if (event->count == 0 && gtk_gl_area_make_current(GTK_GL_AREA(widget)))
if (event->count > 0)
return TRUE;

/* OpenGL functions can be called only if make_current returns true */
if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
{ {
// FIXME: do not do anything if the game tick wasn't called? // FIXME: do not do anything if the game tick wasn't called?
float const delta_time = 33.33333f; float const delta_time = 33.33333f;
@@ -75,18 +83,6 @@ static gint draw(GtkWidget *widget, GdkEventExpose *event)
return TRUE; return TRUE;
} }


static gint reshape(GtkWidget *widget, GdkEventConfigure *event)
{
(void)event;

if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
{
Video::Setup(widget->allocation.width,
widget->allocation.height);
}
return TRUE;
}

int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Initialize GTK */ /* Initialize GTK */


Loading…
Cancel
Save