diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-10 10:20:50 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-10 10:20:50 -0500 |
commit | bdb6a983a84995c144e7452cb4052de2b649577c (patch) | |
tree | 9a5d95a76ece73755eae491a5ef0fa809fb4d30c | |
parent | cfe41fdfebe0913eeac99f8ac78ec52d5e00cc84 (diff) |
fix windows build; add #version to shaders
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | assets/ball_f.glsl | 1 | ||||
-rw-r--r-- | assets/ball_v.glsl | 1 | ||||
-rw-r--r-- | assets/platform_f.glsl | 1 | ||||
-rw-r--r-- | assets/platform_v.glsl | 1 | ||||
-rw-r--r-- | base.cpp | 6 | ||||
-rw-r--r-- | main.cpp | 3 | ||||
-rw-r--r-- | text.cpp | 8 | ||||
-rw-r--r-- | types.hpp | 9 |
10 files changed, 29 insertions, 17 deletions
@@ -11,6 +11,7 @@ TAGS *.dll *.xcf *.lib +*.exp SDL2 box2d .vs* @@ -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; @@ -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; @@ -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 *); @@ -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); @@ -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 |