diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | main.cpp | 2 | ||||
-rw-r--r-- | make.bat | 10 | ||||
-rw-r--r-- | sim.cpp | 9 | ||||
-rw-r--r-- | sim.hpp | 4 |
5 files changed, 17 insertions, 10 deletions
@@ -10,5 +10,7 @@ TAGS *.exe *.dll *.xcf +*.lib SDL2 +box2d .vs* @@ -4,10 +4,10 @@ #include "gui.hpp" #if DEBUG typedef void (*SimFrameFn)(Frame *); +#include "time.cpp" #else #include "sim.cpp" #endif -#include "time.cpp" #ifdef _WIN32 #include <SDL.h> @@ -5,11 +5,11 @@ if _%VCVARS% == _ ( ) if not exist obj mkdir obj -SET CFLAGS=/nologo /W3 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib opengl32.lib +SET CFLAGS=/nologo /W3 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include /I box2d SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib opengl32.lib box2d.lib /MD if _%1 == _ ( - cl main.c /DDEBUG /DEBUG /Zi %CFLAGS% /Fo:obj/urbs /Fe:physics - cl sim.c /DDEBUG /DEBUG /LD %CFLAGS% /Fo:obj/sim /Fe:obj/sim + cl main.cpp /DDEBUG /DEBUG /Zi %CFLAGS% /Fo:obj/urbs /Fe:physics + cl sim.cpp /DDEBUG /DEBUG /LD %CFLAGS% /Fo:obj/sim /Fe:obj/sim echo > obj\sim.dll_changed ) -if _%1 == _release cl main.c /O2 %CFLAGS% /Fe:physics -if _%1 == _profile cl main.c /O2 /DPROFILE %CFLAGS% /Fe:physics +if _%1 == _release cl main.cpp /O2 %CFLAGS% /Fe:physics +if _%1 == _profile cl main.cpp /O2 /DPROFILE %CFLAGS% /Fe:physics @@ -258,12 +258,12 @@ static b2Body *platform_to_body(State *state, Platform *platform) { return body; } -#ifdef _WIN32 -__declspec(dllexport) -#endif #ifdef __cplusplus extern "C" #endif +#ifdef _WIN32 +__declspec(dllexport) +#endif void sim_frame(Frame *frame) { if (frame->memory_size < sizeof(State)) { printf("Not enough memory (got %lu, require %lu).\n", (ulong)frame->memory_size, (ulong)sizeof(State)); @@ -295,10 +295,11 @@ void sim_frame(Frame *frame) { glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT); +#if DEBUG if (state->magic_number != MAGIC_NUMBER || keys_pressed[KEY_F5]) { memset(state, 0, sizeof *state); } - +#endif if (!state->initialized) { logln("Initializing..."); @@ -1,4 +1,8 @@ +#if _WIN32 +#include <box2d.h> +#else #include <Box2D/Box2D.h> +#endif // enums with a specified width are a clang C extension & available in C++11 #if defined __clang__ || __cplusplus >= 201103L #define ENUM_U8 typedef enum : u8 |