source: trunk/src/editor.cpp @ 92

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

Convert everything to the autotools. Managing source dependencies will be
easier.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#include <SDL.h>
2
3#include <stdio.h>
4#include <math.h>
5
6#include "gtkvideo.h"
7#include "game.h"
8
9#include <math.h>
10#include <gtk/gtk.h>
11#include <gtkgl/gtkglarea.h>
12#include <GL/gl.h>
13
14volatile int quit = 0;
15
16static gint main_quit(GtkWidget *widget, GdkEventExpose *event)
17{
18    quit = 1;
19    return FALSE;
20}
21
22int main(int argc, char **argv)
23{
24    GtkWidget *window, *glarea;
25
26    /* initialize gtk */
27    gtk_init(&argc, &argv);
28
29    /* Create new top level window. */
30    window = gtk_window_new( GTK_WINDOW_TOPLEVEL);
31    gtk_window_set_title(GTK_WINDOW(window), "Simple");
32    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
33
34    /* Quit form main if got delete event */
35    gtk_signal_connect(GTK_OBJECT(window), "delete_event",
36                       GTK_SIGNAL_FUNC(main_quit), NULL);
37
38
39    /* You should always delete gtk_gl_area widgets before exit or else
40       GLX contexts are left undeleted, this may cause problems (=core dump)
41       in some systems.
42       Destroy method of objects is not automatically called on exit.
43       You need to manually enable this feature. Do gtk_quit_add_destroy()
44       for all your top level windows unless you are certain that they get
45       destroy signal by other means.
46    */
47    gtk_quit_add_destroy(1, GTK_OBJECT(window));
48
49
50    /* Create new OpenGL widget. */
51    GtkVideo *video = new GtkVideo("LOL", 640, 480);
52    glarea = GTK_WIDGET(video->GetWidget());
53
54
55    /* put glarea into window and show it all */
56    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(glarea));
57    gtk_widget_show(GTK_WIDGET(glarea));
58    gtk_widget_show(GTK_WIDGET(window));
59
60    while (!quit)
61    {
62        while (g_main_context_iteration(NULL, FALSE));
63    }
64
65    return 0;
66}
Note: See TracBrowser for help on using the repository browser.