Quellcode durchsuchen

Minor cleanup in the editor main code.

legacy
Sam Hocevar sam vor 14 Jahren
Ursprung
Commit
b55b3e652b
1 geänderte Dateien mit 14 neuen und 18 gelöschten Zeilen
  1. +14
    -18
      src/gtk/editor.cpp

+ 14
- 18
src/gtk/editor.cpp Datei anzeigen

@@ -50,18 +50,26 @@ static gboolean tick(void *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)))
{
Video::Setup(widget->allocation.width,
widget->allocation.height);
}
Video::Setup(widget->allocation.width, widget->allocation.height);

return TRUE;
}

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

return init(widget);
}

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?
float const delta_time = 33.33333f;
@@ -75,18 +83,6 @@ static gint draw(GtkWidget *widget, GdkEventExpose *event)
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)
{
/* Initialize GTK */


Laden…
Abbrechen
Speichern