source: trunk/src/gtk/editor.cpp @ 162

Last change on this file since 162 was 162, checked in by sam, 11 years ago

Refactor editor to get the glarea object out of the main source file.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdlib>
11
12#include <gtk/gtk.h>
13#include <gtkgl/gtkglarea.h>
14
15#include "core.h"
16#include "glmapview.h"
17#include "debugfps.h"
18
19int main(int argc, char **argv)
20{
21    /* Initialize GTK */
22    g_thread_init(NULL);
23    gtk_init(&argc, &argv);
24
25    if (gdk_gl_query() == FALSE)
26    {
27        g_print("OpenGL not supported\n");
28        return EXIT_FAILURE;
29    }
30
31    /* Build the application interface */
32    GtkBuilder *builder = gtk_builder_new();
33    if (!gtk_builder_add_from_file(builder, "src/gtk/editor.xml", NULL))
34    {
35        g_print("Cannot build from XML\n");
36        return EXIT_FAILURE;
37    }
38    gtk_builder_connect_signals(builder, NULL);
39
40    /* Add our custom GL map viewer */
41    GlMapView *glmapview = new GlMapView(builder);
42
43    /* Show window. We're good to go! */
44    gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(builder, "window1")));
45    g_object_unref(G_OBJECT(builder));
46
47    new DebugFps();
48    glmapview->LoadMap("maps/testmap.tmx");
49
50    gtk_main();
51
52    delete glmapview;
53
54    return EXIT_SUCCESS;
55}
56
Note: See TracBrowser for help on using the repository browser.