Files
haikuports/dev-games/box2d/patches/box2d-2.1.2.patch
2015-01-12 15:11:55 +02:00

168 lines
4.7 KiB
Diff

diff --git a/Box2D/CMakeLists.txt b/Box2D/CMakeLists.txt
index a8ad550..17b3069 100644
--- a/Box2D/CMakeLists.txt
+++ b/Box2D/CMakeLists.txt
@@ -26,7 +26,9 @@ if(BOX2D_BUILD_EXAMPLES)
# Testbed and dependencies.
find_package(OpenGL REQUIRED)
+if(NOT HAIKU) # Haiku has glut, so no need for freeglut
add_subdirectory(freeglut)
+endif(NOT HAIKU)
add_subdirectory(glui)
add_subdirectory(Testbed)
endif(BOX2D_BUILD_EXAMPLES)
diff --git a/Box2D/Testbed/CMakeLists.txt b/Box2D/Testbed/CMakeLists.txt
index d1be5c0..ad716e4 100644
--- a/Box2D/Testbed/CMakeLists.txt
+++ b/Box2D/Testbed/CMakeLists.txt
@@ -72,10 +72,19 @@ add_executable(Testbed
${Testbed_Tests_SRCS}
)
-target_link_libraries (
- Testbed
- Box2D
- freeglut_static
- glui
- ${OPENGL_LIBRARIES}
-)
+if(HAIKU) # Haiku has glut, so no need for freeglut
+ target_link_libraries (
+ Testbed
+ Box2D
+ glui
+ ${OPENGL_LIBRARIES}
+)
+else(HAIKU)
+ target_link_libraries (
+ Testbed
+ Box2D
+ freeglut_static
+ glui
+ ${OPENGL_LIBRARIES}
+)
+endif(HAIKU)
diff --git a/Box2D/Testbed/Framework/Render.cpp b/Box2D/Testbed/Framework/Render.cpp
index 3a6c680..b406367 100644
--- a/Box2D/Testbed/Framework/Render.cpp
+++ b/Box2D/Testbed/Framework/Render.cpp
@@ -18,12 +18,16 @@
#include "Render.h"
+#ifdef __HAIKU__
+#include <GL/glut.h>
+#else
#include "freeglut/GL/glut.h"
+#endif
#include <cstdio>
#include <cstdarg>
-#include <cstring>
+#include <cstring>
void DebugDraw::DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color)
{
diff --git a/Box2D/Testbed/Framework/Test.cpp b/Box2D/Testbed/Framework/Test.cpp
index 9e6a935..f43ee39 100644
--- a/Box2D/Testbed/Framework/Test.cpp
+++ b/Box2D/Testbed/Framework/Test.cpp
@@ -19,7 +19,11 @@
#include "Test.h"
#include "Render.h"
+#ifdef __HAIKU__
+#include <GL/glut.h>
+#else
#include "freeglut/GL/glut.h"
+#endif
#include <cstdio>
diff --git a/Box2D/Testbed/Tests/TestEntries.cpp b/Box2D/Testbed/Tests/TestEntries.cpp
index e12c102..1ca1db1 100644
--- a/Box2D/Testbed/Tests/TestEntries.cpp
+++ b/Box2D/Testbed/Tests/TestEntries.cpp
@@ -18,7 +18,11 @@
#include "../Framework/Test.h"
#include "../Framework/Render.h"
+#ifdef __HAIKU__
+#include <GL/glut.h>
+#else
#include "../../freeglut/GL/glut.h"
+#endif
#include <cstring>
#include "ApplyForce.h"
diff --git a/Box2D/glui/GL/glui.h b/Box2D/glui/GL/glui.h
index a412a77..66a846e 100644
--- a/Box2D/glui/GL/glui.h
+++ b/Box2D/glui/GL/glui.h
@@ -49,6 +49,8 @@
#ifdef __APPLE__
#include <GLUT/glut.h>
+ #elif __HAIKU__
+ #include <GL/glut.h>
#else
#include "../../freeglut/GL/glut.h"
//#include <GL/glut.h>
diff --git a/Box2D/glui/algebra3.cpp b/Box2D/glui/algebra3.cpp
index ddc18f4..47f93b3 100644
--- a/Box2D/glui/algebra3.cpp
+++ b/Box2D/glui/algebra3.cpp
@@ -830,11 +830,7 @@ vec4 operator*(float d, const vec4 &a)
vec4 operator*(const mat4 &a, const vec4 &v)
{
- #define ROWCOL(i) \
- a.v[i].n[0]*v.n[VX] + \
- a.v[i].n[1]*v.n[VY] + \
- a.v[i].n[2]*v.n[VZ] + \
- a.v[i].n[3]*v.n[VW]
+ #define ROWCOL(i) a.v[i].n[0]*v.n[VX] + a.v[i].n[1]*v.n[VY] + a.v[i].n[2]*v.n[VZ] + a.v[i].n[3]*v.n[VW]
return vec4(ROWCOL(0), ROWCOL(1), ROWCOL(2), ROWCOL(3));
@@ -1107,8 +1103,7 @@ mat3 operator-(const mat3 &a, const mat3 &b)
mat3 operator*(const mat3 &a, const mat3 &b)
{
- #define ROWCOL(i, j) \
- a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j]
+ #define ROWCOL(i, j) a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j]
return mat3(
vec3(ROWCOL(0,0), ROWCOL(0,1), ROWCOL(0,2)),
@@ -1413,11 +1408,7 @@ mat4 operator-(const mat4 &a, const mat4 &b)
mat4 operator*(const mat4 &a, const mat4 &b)
{
- #define ROWCOL(i, j) \
- a.v[i].n[0]*b.v[0][j] + \
- a.v[i].n[1]*b.v[1][j] + \
- a.v[i].n[2]*b.v[2][j] + \
- a.v[i].n[3]*b.v[3][j]
+ #define ROWCOL(i, j) a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j] + a.v[i].n[3]*b.v[3][j]
return mat4(
vec4(ROWCOL(0,0), ROWCOL(0,1), ROWCOL(0,2), ROWCOL(0,3)),
diff --git a/Box2D/glui/glui_internal.h b/Box2D/glui/glui_internal.h
index 20efc6f..8f450e1 100644
--- a/Box2D/glui/glui_internal.h
+++ b/Box2D/glui/glui_internal.h
@@ -74,8 +74,7 @@
/************ check if a 2D point lies within a 2D box ***************/
#ifndef PT_IN_BOX
-#define PT_IN_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) \
-( IN_BOUNDS(x,lo_x,hi_x) AND IN_BOUNDS(y,lo_y,hi_y) )
+#define PT_IN_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) ( IN_BOUNDS(x,lo_x,hi_x) AND IN_BOUNDS(y,lo_y,hi_y) )
#endif
/****** check if value lies on proper side of another value *****/