]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Game.h
Force a double-buffered GL context.
[lugaru.git] / Source / Game.h
index 96feef0de2d4d474d553cd3d424f72a173530f57..65f6887d23b0249492e2183c91ecfff545b980e3 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _GAME_H_
 #define _GAME_H_
 
+#if (defined(__APPLE__) && defined(__MACH__))
+#  ifdef PLATFORM_MACOSX
+#    error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build.
+#  endif
+#endif
+
 #ifdef PLATFORM_MACOSX
 #include <Carbon.h>
 #include "Quicktime.h"
 //#include <glut.h>
 
 #include "TGALoader.h"
-#ifdef WIN32
-#include "WinInput.h"
-#elif USE_SDL
+
+#if USE_SDL
 #include "SDL.h"
-#include "SDLInput.h"
+#endif
+
+#if !PLATFORM_MACOSX
+#include "WinInput.h"
 #else
 #include "Macinput.h"
 #endif
+
 #include "Terrain.h"
 #include "Skybox.h"
 #include "Skeleton.h"
 
 extern GLuint rabbittexture;
 
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-
 class Game             
 {
 public:
@@ -229,7 +229,7 @@ public:
        void LoadingScreen();
        void FadeLoadingScreen(float howmuch);
        void Dispose();
-       int DrawGLScene(GLvoid);
+       int DrawGLScene(void);
        void Tick();
        void TickOnce();
        void TickOnceAfter();
@@ -279,4 +279,36 @@ public:
 
 };
 
-#endif
\ No newline at end of file
+#ifndef __forceinline
+#  ifdef __GNUC__
+#    define __forceinline inline __attribute__((always_inline))
+#  endif
+#endif
+
+static __forceinline void swap_gl_buffers(void)
+{
+#ifdef WIN32
+    extern HDC hDC;
+    SwapBuffers( hDC);
+#elif USE_SDL
+    SDL_GL_SwapBuffers();
+#elif PLATFORM_MACOSX
+    extern AGLContext gaglContext;
+    aglSwapBuffers(gaglContext);
+#else
+    #error define your platform.
+#endif
+}
+
+#ifdef __GNUC__
+#define LONGLONGCONST(x) (x##ll)
+#else
+#define LONGLONGCONST(x) (x)
+#endif
+
+extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
+//#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
+#define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }
+//#define STUBBED(x)
+
+#endif