summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md15
-rw-r--r--assets/ball_f.glsl1
-rw-r--r--assets/ball_v.glsl1
-rw-r--r--assets/platform_f.glsl1
-rw-r--r--assets/platform_v.glsl1
-rw-r--r--base.cpp6
-rw-r--r--main.cpp3
-rw-r--r--text.cpp8
-rw-r--r--types.hpp9
10 files changed, 29 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 6001cd5..0d95ca3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ TAGS
*.dll
*.xcf
*.lib
+*.exp
SDL2
box2d
.vs*
diff --git a/README.md b/README.md
index 47c1441..f974233 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-To install box2d:
+To install box2d on Linux/OS X:
```bash
git clone https://github.com/erincatto/box2d/
cd box2d
@@ -7,3 +7,16 @@ cd build
cmake -DBOX2D_BUILD_TESTBED=False ..
sudo make -j8 install
```
+On Windows (you need `vcvarsall.bat` and `git` in your PATH):
+```bash
+vcvarsall x64
+git clone https://github.com/erincatto/box2d/
+cd box2d
+xcopy /s /i include\box2d ..\box2d
+mkdir build
+cd build
+cmake ..
+cmake --build . --config Release
+copy bin\Release\box2d.lib ..\..
+```
+You will also need SDL2.
diff --git a/assets/ball_f.glsl b/assets/ball_f.glsl
index 779a0ec..8cd5d84 100644
--- a/assets/ball_f.glsl
+++ b/assets/ball_f.glsl
@@ -1,3 +1,4 @@
+#version 110
varying vec4 color;
varying vec2 pos;
uniform vec2 center;
diff --git a/assets/ball_v.glsl b/assets/ball_v.glsl
index 7908bc7..cd0301f 100644
--- a/assets/ball_v.glsl
+++ b/assets/ball_v.glsl
@@ -1,3 +1,4 @@
+#version 110
varying vec4 color;
varying vec2 pos;
uniform mat4 transform;
diff --git a/assets/platform_f.glsl b/assets/platform_f.glsl
index 7877ff5..685b5b0 100644
--- a/assets/platform_f.glsl
+++ b/assets/platform_f.glsl
@@ -1,3 +1,4 @@
+#version 110
varying vec4 color;
varying vec2 p1, p2;
varying vec2 pos;
diff --git a/assets/platform_v.glsl b/assets/platform_v.glsl
index 8f57aab..4178773 100644
--- a/assets/platform_v.glsl
+++ b/assets/platform_v.glsl
@@ -1,3 +1,4 @@
+#version 110
// "position" within line (0,0) = bottom-left corner, (1,1) = top-right corner
attribute vec2 vertex_p1, vertex_p2;
varying vec4 color;
diff --git a/base.cpp b/base.cpp
index 3a8cec9..95135a0 100644
--- a/base.cpp
+++ b/base.cpp
@@ -1,11 +1,5 @@
// this file includes functions, etc. used just about everywhere
-#if DEBUG
-#define logln(...) printf(__VA_ARGS__), printf("\n");
-#else
-#define logln(...)
-#endif
-
// allocates aligned temporary memory
static u8 *tmp_alloc(State *state, size_t bytes) {
u32 used = state->tmp_mem_used;
diff --git a/main.cpp b/main.cpp
index 52d547a..08cbfd7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,9 +2,6 @@
#define AUTO_RELOAD_CODE 0
#endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
#include "gui.hpp"
#if AUTO_RELOAD_CODE
typedef void (*SimFrameFn)(Frame *);
diff --git a/text.cpp b/text.cpp
index 1db0226..7bf6168 100644
--- a/text.cpp
+++ b/text.cpp
@@ -31,14 +31,14 @@ static int text_font_load_(State *state, Font *font, u8 const *data,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
font->texture = texture;
- debug_println("Loaded font (size = %f), using %d rows of a %dx%d bitmap.",
+ logln("Loaded font (size = %f), using %d rows of a %dx%d bitmap.",
char_height, err, bitmap_width, bitmap_height);
} else {
// bitmap not big enough
ret = 0;
}
} else {
- debug_println("Not enough memory for font bitmap.");
+ logln("Not enough memory for font bitmap.");
ret = -1;
}
tmp_pop(state, mark);
@@ -69,11 +69,11 @@ static bool text_font_load(State *state, Font *font, char const *filename, float
}
free(data);
} else {
- debug_println("Out of memory.");
+ logln("Out of memory.");
}
fclose(fp);
} else {
- debug_println("File not found: %s.", filename);
+ logln("File not found: %s.", filename);
}
if (!success) {
memset(font, 0, sizeof *font);
diff --git a/types.hpp b/types.hpp
index 5f36514..b97e037 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,6 +1,9 @@
#ifndef TYPES_H_
#define TYPES_H_
+#if _WIN32
+#include <windows.h>
+#endif
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -61,9 +64,9 @@ typedef int64_t i64;
#if DEBUG
#if __unix__
-#define debug_println(...) printf(__VA_ARGS__), printf("\n")
+#define logln(...) printf(__VA_ARGS__), printf("\n")
#else // __unix__
-static void debug_println(char const *fmt, ...) {
+static void logln(char const *fmt, ...) {
char buf[256];
va_list args;
va_start(args, fmt);
@@ -74,7 +77,7 @@ static void debug_println(char const *fmt, ...) {
}
#endif // __unix__
#else // DEBUG
-#define debug_println(...)
+#define logln(...)
#endif