From 93a4c23b2378bd5d0cc738cb649d6957c02ec7b3 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 17 Jan 2011 20:25:16 +0000 Subject: [PATCH] Split test-map into deus-hax and monsterz. --- .gitignore | 5 +- Makefile.am | 2 +- configure.ac | 8 + src/Makefile.am | 23 +-- src/core.h | 1 - src/gtk/editor.cpp | 68 ------- src/gtk/editor.xml | 399 ------------------------------------------ src/gtk/glmapview.cpp | 304 -------------------------------- src/gtk/glmapview.h | 55 ------ src/mapviewer.cpp | 90 ---------- src/mapviewer.h | 42 ----- src/test-map.cpp | 88 ---------- 12 files changed, 18 insertions(+), 1067 deletions(-) delete mode 100644 src/gtk/editor.cpp delete mode 100644 src/gtk/editor.xml delete mode 100644 src/gtk/glmapview.cpp delete mode 100644 src/gtk/glmapview.h delete mode 100644 src/mapviewer.cpp delete mode 100644 src/mapviewer.h delete mode 100644 src/test-map.cpp diff --git a/.gitignore b/.gitignore index 320ed33c..d85f4323 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,9 @@ core.* .*.swp *~ # Our binaries -src/test-map -src/editor +deushax/deushax +deushax/editor +monsterz/monsterz tools/make-font # Our data art/*.png diff --git a/Makefile.am b/Makefile.am index 8a5c1e0e..ce07dc15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = src tools art gfx +SUBDIRS = src deushax monsterz tools art gfx DIST_SUBDIRS = $(SUBDIRS) maps EXTRA_DIST = bootstrap build diff --git a/configure.ac b/configure.ac index 2adb1128..5f948af9 100644 --- a/configure.ac +++ b/configure.ac @@ -86,15 +86,23 @@ fi AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no") +# How to use the Lol Engine inside this tree +LOL_CFLAGS="-I \$(top_srcdir)/src `pkg-config --cflags sdl gl SDL_image`" +LOL_LIBS="`pkg-config --libs sdl gl SDL_image`" + if test "${enable_release}" = "yes"; then AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release) fi AC_SUBST(MATH_LIBS) +AC_SUBST(LOL_CFLAGS) +AC_SUBST(LOL_LIBS) AC_CONFIG_FILES([ Makefile src/Makefile + monsterz/Makefile + deushax/Makefile tools/Makefile art/Makefile art/test/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 2259c4d2..48e814db 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,28 +1,17 @@ -noinst_PROGRAMS = test-map editor +noinst_LIBRARIES = liblol.a -noinst_LIBRARIES = libcommon.a - -libcommon_a_SOURCES = \ +liblol_a_SOURCES = \ core.h matrix.h game.cpp game.h tiler.cpp tiler.h dict.cpp dict.h \ scene.cpp scene.h font.cpp font.h layer.cpp layer.h map.cpp map.h \ entity.cpp entity.h ticker.cpp ticker.h tileset.cpp tileset.h \ forge.cpp forge.h video.cpp video.h timer.cpp timer.h bitfield.h \ profiler.cpp profiler.h input.h input.cpp world.cpp world.h \ + \ + sdlinput.cpp sdlinput.h \ + \ debugfps.cpp debugfps.h debugsprite.cpp debugsprite.h \ debugrecord.cpp debugrecord.h debugstats.cpp debugstats.h \ debugsphere.cpp debugsphere.h debugboard.cpp debugboard.h -libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` - -test_map_SOURCES = test-map.cpp sdlinput.cpp sdlinput.h -test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` @PIPI_CFLAGS@ -test_map_LDADD = libcommon.a -test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` @PIPI_LIBS@ - -editor_SOURCES = gtk/editor.cpp gtk/glmapview.cpp gtk/glmapview.h \ - mapviewer.cpp mapviewer.h -editor_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image gtk+-2.0 gtkgl-2.0` -editor_LDADD = libcommon.a -editor_LDFLAGS = `pkg-config --libs sdl gl gtk+-2.0 gtkgl-2.0 SDL_image` -EXTRA_DIST = gtk/editor.xml +liblol_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` diff --git a/src/core.h b/src/core.h index aad9e5f7..dc088d23 100644 --- a/src/core.h +++ b/src/core.h @@ -26,7 +26,6 @@ #include "font.h" #include "game.h" #include "tileset.h" -#include "mapviewer.h" #include "world.h" // Other objects diff --git a/src/gtk/editor.cpp b/src/gtk/editor.cpp deleted file mode 100644 index d28c4639..00000000 --- a/src/gtk/editor.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include -#include - -#include "core.h" -#include "glmapview.h" -#include "debugfps.h" - -static gboolean delayed_quit(GtkWidget *w, GdkEvent *e, void *data) -{ - (void)w; - (void)e; - (void)data; - gtk_main_quit(); - return TRUE; -} - -int main(int argc, char **argv) -{ - /* Initialize GTK */ - g_thread_init(NULL); - gtk_init(&argc, &argv); - - if (gdk_gl_query() == FALSE) - { - g_print("OpenGL not supported\n"); - return EXIT_FAILURE; - } - - /* Build the application interface */ - GtkBuilder *builder = gtk_builder_new(); - if (!gtk_builder_add_from_file(builder, "src/gtk/editor.xml", NULL)) - { - g_print("Cannot build from XML\n"); - return EXIT_FAILURE; - } - gtk_builder_connect_signals(builder, NULL); - - /* Add our custom GL map viewer */ - GlMapView *glmapview = new GlMapView(builder); - - /* Show window. We're good to go! */ - GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "window")); - gtk_widget_show_all(window); - gtk_signal_connect(GTK_OBJECT(window), "delete_event", - GTK_SIGNAL_FUNC(delayed_quit), NULL); - g_object_unref(G_OBJECT(builder)); - - glmapview->LoadMap("maps/testmap.tmx"); - new DebugFps(); - - gtk_main(); - - delete glmapview; - - return EXIT_SUCCESS; -} - diff --git a/src/gtk/editor.xml b/src/gtk/editor.xml deleted file mode 100644 index b30f3c7c..00000000 --- a/src/gtk/editor.xml +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - Deus Hax Editor - - - True - vertical - - - True - - - True - _File - True - - - True - - - True - True - action_new - True - True - - - - - True - True - action_open - True - True - - - - - gtk-save - True - True - True - - - - - gtk-save-as - True - True - True - - - - - True - - - - - gtk-quit - True - True - True - True - - - - - - - - - - True - _Edit - True - - - True - - - gtk-cut - True - True - True - - - - - gtk-copy - True - True - True - - - - - gtk-paste - True - True - True - - - - - gtk-delete - True - True - True - - - - - - - - - True - _View - True - - - - - True - _Help - True - - - True - - - gtk-about - True - True - True - True - - - - - - - - - - False - 0 - - - - - True - - - True - True - action_new - toolbutton - True - - - False - True - - - - - True - True - action_open - Open... - True - - - False - True - - - - - True - True - action_save - Save - True - - - False - True - - - - - True - - - False - True - - - - - True - True - action_undo - toolbutton5 - True - - - False - True - - - - - True - True - action_redo - toolbutton6 - True - - - False - True - - - - - True - - - False - True - - - - - False - 1 - - - - - True - True - - - True - 2 - 2 - - - True - gl_hadj - - - 1 - 2 - GTK_SHRINK - - - - - True - vertical - gl_vadj - - - 1 - 2 - GTK_SHRINK - - - - - True - queue - - - - - - GTK_EXPAND | GTK_SHRINK | GTK_FILL - GTK_EXPAND | GTK_SHRINK | GTK_FILL - - - - - - - - False - True - - - - - 150 - True - Palette will be here - - - False - False - - - - - 2 - - - - - True - 2 - - - False - 3 - - - - - - - 100 - 1 - 10 - 10 - - - 100 - 1 - 10 - 10 - - - 5 - True - center - normal - Deus Hax Editor - © 2010 Sam Hocevar <sam@hocevar.net> - http://deushax.zoy.org/ - - - - - - - True - vertical - 2 - - - - - - True - end - - - False - end - 0 - - - - - - - Open... - gtk-open - True - - - gtk-new - True - - - Save - gtk-save - True - - - Undo - gtk-undo - True - - - Redo - gtk-redo - True - - diff --git a/src/gtk/glmapview.cpp b/src/gtk/glmapview.cpp deleted file mode 100644 index b4e872f2..00000000 --- a/src/gtk/glmapview.cpp +++ /dev/null @@ -1,304 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include "core.h" -#include "glmapview.h" - -static float const FPS = 30.0f; - -GlMapView::GlMapView(GtkBuilder *builder) - : hadj(GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gl_hadj"))), - vadj(GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gl_vadj"))), - ticking(FALSE), panning(FALSE), - mapviewer(0), - xpan(0.0), ypan(0.0) -{ - /* Create new OpenGL widget */ - int attrlist[] = - { - GDK_GL_RGBA, - GDK_GL_RED_SIZE, 1, - GDK_GL_GREEN_SIZE, 1, - GDK_GL_BLUE_SIZE, 1, - GDK_GL_DEPTH_SIZE, 16, - GDK_GL_DOUBLEBUFFER, - GDK_GL_NONE - }; - - glarea = gtk_gl_area_new(attrlist); - gtk_widget_set_usize(glarea, 400, 300); - gtk_widget_set_events(glarea, GDK_EXPOSURE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK); - gtk_widget_set_can_focus(glarea, TRUE); - - GtkContainer *cont = GTK_CONTAINER(gtk_builder_get_object(builder, - "gl_container")); - gtk_container_add(cont, glarea); - - /* We tick from the idle function instead of a timeout to avoid - * stealing time from the GTK loop when the callback time exceeds - * the timeout value. */ - g_idle_add((GSourceFunc)IdleTickSignal, this); - - /* We must divert gtk_main_quit() to release our resources when the - * GL widget is still realised. We'll call gtk_main_quit() when we - * are sure that everything has been cleaned. */ - gtk_quit_add(0, (GtkFunction)ShutdownSignal, this); - - gtk_signal_connect(GTK_OBJECT(glarea), "realize", - GTK_SIGNAL_FUNC(SetupSignal), this); - gtk_signal_connect(GTK_OBJECT(glarea), "expose_event", - GTK_SIGNAL_FUNC(DrawSignal), this); - gtk_signal_connect(GTK_OBJECT(glarea), "configure_event", - GTK_SIGNAL_FUNC(ReshapeSignal), this); - - gtk_signal_connect(GTK_OBJECT(glarea), "button_press_event", - GTK_SIGNAL_FUNC(MouseButtonSignal), this); - gtk_signal_connect(GTK_OBJECT(glarea), "button_release_event", - GTK_SIGNAL_FUNC(MouseButtonSignal), this); - gtk_signal_connect(GTK_OBJECT(glarea), "motion_notify_event", - GTK_SIGNAL_FUNC(MouseMotionSignal), this); - - gtk_signal_connect(GTK_OBJECT(glarea), "key_press_event", - GTK_SIGNAL_FUNC(KeyPressSignal), this); -} - -void GlMapView::LoadMap(char const *path) -{ - // FIXME: detect when the map viewer is killed - mapviewer = new MapViewer(path); - Ticker::Ref(mapviewer); - - UpdateAdjustments(); -} - -void GlMapView::CloseMap() -{ - if (mapviewer) - Ticker::Unref(mapviewer); - mapviewer = NULL; - - UpdateAdjustments(); -} - -gboolean GlMapView::IdleTick() -{ - if (Ticker::Finished()) - { - gtk_main_quit(); - return FALSE; - } - - ticking = TRUE; - - if (mapviewer) - mapviewer->SetPOV(gtk_adjustment_get_value(hadj), - mapviewer->GetHeight() - glarea->allocation.height - - gtk_adjustment_get_value(vadj)); - - /* Tick the game */ - Ticker::TickGame(); - - gtk_widget_draw(GTK_WIDGET(glarea), NULL); - - return TRUE; -} - -gboolean GlMapView::Setup() -{ - /* Set up display */ - gtk_widget_grab_focus(glarea); - if (gtk_gl_area_make_current(GTK_GL_AREA(glarea))) - Video::Setup(glarea->allocation.width, glarea->allocation.height); - - UpdateAdjustments(); - - return TRUE; -} - -gboolean GlMapView::Shutdown() -{ - CloseMap(); - Ticker::Shutdown(); - /* Hijack the exit process by adding another level of gtk_main */ - gtk_widget_set_sensitive(gtk_widget_get_toplevel(glarea), FALSE); - gtk_main(); - return TRUE; -} - -gboolean GlMapView::Draw(GdkEventExpose *e) -{ - if (e->count > 0) - return TRUE; - - /* OpenGL functions can be called only if make_current returns true */ - if (ticking && gtk_gl_area_make_current(GTK_GL_AREA(glarea))) - { - ticking = FALSE; - - /* Clear the screen, tick the renderer, show the frame and - * clamp to desired framerate */ - Video::Clear(); - Ticker::TickDraw(); - gtk_gl_area_swapbuffers(GTK_GL_AREA(glarea)); - while (g_main_context_iteration(NULL, FALSE)) - ; - - // FIXME: do some GTK stuff in here - Ticker::ClampFps(1000.0f / FPS); - } - - return TRUE; -} - -void GlMapView::Scroll(double dx, double dy) -{ - gtk_adjustment_set_value(hadj, gtk_adjustment_get_value(hadj) + dx); - gtk_adjustment_set_value(vadj, gtk_adjustment_get_value(vadj) + dy); - - UpdateAdjustments(); -} - -void GlMapView::UpdateAdjustments() -{ - float w = mapviewer ? mapviewer->GetWidth() : glarea->allocation.width; - float h = mapviewer ? mapviewer->GetHeight() : glarea->allocation.height; - - /* Manage adjustments */ - struct { GtkAdjustment *adj; float map_size, sw_size; } s[2] = - { - { hadj, w, glarea->allocation.width }, - { vadj, h, glarea->allocation.height }, - }; - - for (int i = 0; i < 2; i++) - { - gtk_adjustment_set_lower(s[i].adj, 0); - gtk_adjustment_set_upper(s[i].adj, s[i].map_size); - gtk_adjustment_set_step_increment(s[i].adj, 1); - gtk_adjustment_set_page_increment(s[i].adj, s[i].sw_size); - gtk_adjustment_set_page_size(s[i].adj, s[i].sw_size); - - float val = gtk_adjustment_get_value(s[i].adj); - if (val + s[i].sw_size > s[i].map_size) - { - gtk_adjustment_set_value(s[i].adj, - s[i].map_size - s[i].sw_size); - gtk_adjustment_value_changed(s[i].adj); - } - } -} - -gboolean GlMapView::MouseButton(GdkEventButton *e) -{ - if (e->type == GDK_BUTTON_PRESS && e->button == 2) - { - panning = TRUE; - xpan = e->x; - ypan = e->y; - GdkCursor *cursor = gdk_cursor_new(GDK_HAND1); - gdk_window_set_cursor(glarea->window, cursor); - gdk_cursor_unref(cursor); - return FALSE; - } - else if (e->type == GDK_BUTTON_RELEASE && e->button == 2) - { - panning = FALSE; - gdk_window_set_cursor(glarea->window, NULL); - return FALSE; - } - - return TRUE; -} - -gboolean GlMapView::MouseMotion(GdkEventMotion *e) -{ - if (panning) - { - Scroll(xpan - e->x, ypan - e->y); - xpan = e->x; - ypan = e->y; - return TRUE; - } - - return FALSE; -} - -gboolean GlMapView::KeyPress(GdkEventKey *e) -{ - switch (e->keyval) - { - case GDK_Up: Scroll( 0.0, -10.0); return TRUE; - case GDK_Down: Scroll( 0.0, 10.0); return TRUE; - case GDK_Left: Scroll(-10.0, 0.0); return TRUE; - case GDK_Right: Scroll( 10.0, 0.0); return TRUE; - } - - return FALSE; -} - -/* Private signal slots */ -gboolean GlMapView::IdleTickSignal(GlMapView *that) -{ - return that->IdleTick(); -} - -gboolean GlMapView::SetupSignal(GtkWidget *w, GlMapView *that) -{ - (void)w; - return that->Setup(); -} - -gboolean GlMapView::ShutdownSignal(GlMapView *that) -{ - return that->Shutdown(); -} - -gboolean GlMapView::DrawSignal(GtkWidget *w, GdkEventExpose *e, - GlMapView *that) -{ - (void)w; - return that->Draw(e); -} - -gboolean GlMapView::ReshapeSignal(GtkWidget *w, GdkEventConfigure *e, - GlMapView *that) -{ - (void)w; - (void)e; - return that->Setup(); -} - -gboolean GlMapView::MouseButtonSignal(GtkWidget *w, GdkEventButton *e, - GlMapView *that) -{ - (void)w; - return that->MouseButton(e); -} - -gboolean GlMapView::MouseMotionSignal(GtkWidget *w, GdkEventMotion *e, - GlMapView *that) -{ - (void)w; - return that->MouseMotion(e); -} - -gboolean GlMapView::KeyPressSignal(GtkWidget *w, GdkEventKey *e, - GlMapView *that) -{ - (void)w; - return that->KeyPress(e); -} - diff --git a/src/gtk/glmapview.h b/src/gtk/glmapview.h deleted file mode 100644 index e51801ea..00000000 --- a/src/gtk/glmapview.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if !defined __DH_GLMAPVIEW_H__ -#define __DH_GLMAPVIEW_H__ - -#include - -class GlMapView -{ -public: - GlMapView(GtkBuilder *builder); - void LoadMap(char const *path); - void CloseMap(); - -private: - /* Private methods */ - gboolean IdleTick(); - gboolean Setup(); - gboolean Shutdown(); - gboolean Draw(GdkEventExpose *e); - void Scroll(double dx, double dy); - void UpdateAdjustments(); - gboolean MouseButton(GdkEventButton *e); - gboolean MouseMotion(GdkEventMotion *e); - gboolean KeyPress(GdkEventKey *e); - - /* Private signal slots */ - static gboolean IdleTickSignal(GlMapView *that); - static gboolean SetupSignal(GtkWidget *w, GlMapView *that); - static gboolean ShutdownSignal(GlMapView *that); - static gboolean DrawSignal(GtkWidget *w, GdkEventExpose *e, - GlMapView *that); - static gboolean ReshapeSignal(GtkWidget *w, GdkEventConfigure *e, - GlMapView *that); - static gboolean MouseButtonSignal(GtkWidget *w, GdkEventButton *e, - GlMapView *that); - static gboolean MouseMotionSignal(GtkWidget *w, GdkEventMotion *e, - GlMapView *that); - static gboolean KeyPressSignal(GtkWidget *w, GdkEventKey *e, - GlMapView *that); - -private: - GtkAdjustment *hadj, *vadj; - GtkWidget *glarea; - gboolean ticking, panning; - - MapViewer *mapviewer; - double xpan, ypan; -}; - -#endif // __DH_GLMAPVIEW_H__ - diff --git a/src/mapviewer.cpp b/src/mapviewer.cpp deleted file mode 100644 index 2c120780..00000000 --- a/src/mapviewer.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "core.h" - -/* - * MapViewer implementation class - */ - -class MapViewerData -{ - friend class MapViewer; - -private: - Map *map; - int x, y; - int povx, povy; - int done; - - Scene *scene; -}; - -/* - * Public MapViewer class - */ - -MapViewer::MapViewer(char const *mapname) -{ - data = new MapViewerData(); - data->map = new Map(mapname); - data->x = data->y = 0; - data->done = 0; - data->scene = NULL; -} - -MapViewer::~MapViewer() -{ - delete data->map; - delete data; -} - -void MapViewer::TickGame(float deltams) -{ - Entity::TickGame(deltams); -} - -void MapViewer::TickDraw(float deltams) -{ - Entity::TickDraw(deltams); - - GetScene(); - - data->map->Render(data->scene, -data->povx, -data->povy, 0); - data->scene->Render(); - - delete data->scene; - data->scene = NULL; -} - -Scene *MapViewer::GetScene() -{ - if (!data->scene) - data->scene = new Scene(); - return data->scene; -} - -int MapViewer::GetWidth() -{ - return data->map->GetWidth(); -} - -int MapViewer::GetHeight() -{ - return data->map->GetHeight(); -} - -void MapViewer::SetPOV(int x, int y) -{ - data->povx = x; - data->povy = y; -} - diff --git a/src/mapviewer.h b/src/mapviewer.h deleted file mode 100644 index 4fb2d273..00000000 --- a/src/mapviewer.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -// -// The MapViewer class -// ------------------- -// - -#if !defined __DH_MAPVIEWER_H__ -#define __DH_MAPVIEWER_H__ - -#include "entity.h" -#include "scene.h" - -class MapViewerData; - -class MapViewer : public Entity -{ -public: - MapViewer(char const *mapname); - ~MapViewer(); - -protected: - /* Inherited from Entity */ - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); - -public: - /* New methods */ - Scene *GetScene(); - int GetWidth(); - int GetHeight(); - void SetPOV(int x, int y); - -private: - MapViewerData *data; -}; - -#endif // __DH_MAPVIEWER_H__ - diff --git a/src/test-map.cpp b/src/test-map.cpp deleted file mode 100644 index 5787c70b..00000000 --- a/src/test-map.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#if defined _WIN32 -# include -#endif - -#include - -#include "core.h" -#include "sdlinput.h" -#include "debugfps.h" -#include "debugboard.h" -#include "debugsprite.h" -#include "debugsphere.h" -#include "debugrecord.h" -#include "debugstats.h" - -static float const FPS = 30.0f; - -int main(int argc, char **argv) -{ - /* Initialise SDL */ - if (SDL_Init(SDL_INIT_VIDEO) < 0) - { - fprintf(stderr, "Cannot initialise SDL: %s\n", SDL_GetError()); - return EXIT_FAILURE; - } - - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_Surface *video = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL); - if (!video) - { - fprintf(stderr, "Cannot create OpenGL screen: %s\n", SDL_GetError()); - SDL_Quit(); - return EXIT_FAILURE; - } - - SDL_WM_SetCaption("Map Test (SDL)", NULL); - SDL_ShowCursor(0); - //SDL_WM_GrabInput(SDL_GRAB_ON); - - /* Initialise OpenGL */ - Video::Setup(video->w, video->h); - - /* Create a game */ -#if defined _WIN32 - _chdir(".."); /* Temporary Win32 hack */ -#endif - Game *game = new Game("maps/testmap.tmx"); - game->SetMouse(160, 96); - - /* Register an input driver and some debug stuff */ - new SdlInput(); - new DebugFps(); - new DebugSprite(game); - new DebugBoard(game); - new DebugSphere(); - //new DebugRecord("lolengine.ogg"); - new DebugStats("stats.txt"); - - while (!Ticker::Finished()) - { - /* Tick the game */ - Ticker::TickGame(); - - /* Clear the screen, tick the renderer, show the frame and - * clamp to desired framerate. */ - Video::Clear(); - Ticker::TickDraw(); - SDL_GL_SwapBuffers(); - Ticker::ClampFps(1000.0f / FPS); - } - - SDL_Quit(); - - return EXIT_SUCCESS; -} -