From dcefab4d5e9d9cff3bfbc65e45fae9309d426a69 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 30 Oct 2015 11:45:31 -0400 Subject: win32 build --- Makefile | 5 +++++ freetype6.dll | Bin 0 -> 522240 bytes glew32.dll | Bin 0 -> 403968 bytes include/common.h | 6 ++++++ main.cpp | 11 +++++++++-- 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 freetype6.dll create mode 100644 glew32.dll diff --git a/Makefile b/Makefile index 8ac3b3d..bbeff1e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ LIBS = -lGL -lGLEW -lSDL2main -lSDL2 -lfreetype -lSDL2_image -lSDL2_mixer +WIN_LIBS = -lopengl32 -lglew32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -lfreetype + FLAGS = -m32 -std=c++11 -Iinclude -Iinclude/freetype2 all: @@ -8,6 +10,9 @@ all: @echo " CXX main.cpp" @g++ $(FLAGS) -o main main.cpp out/*.o $(LIBS) +win32: + @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS) + clean: @echo " RM main" @-rm -f main diff --git a/freetype6.dll b/freetype6.dll new file mode 100644 index 0000000..e35edc6 Binary files /dev/null and b/freetype6.dll differ diff --git a/glew32.dll b/glew32.dll new file mode 100644 index 0000000..c9414c2 Binary files /dev/null and b/glew32.dll differ diff --git a/include/common.h b/include/common.h index 359e825..25d5abf 100644 --- a/include/common.h +++ b/include/common.h @@ -14,6 +14,7 @@ * Include GLEW and the SDL 2 headers */ +#define GLEW_STATIC #include #include @@ -23,6 +24,11 @@ #include #include +#ifdef __WIN32__ +typedef unsigned int uint; +#undef near +#endif + /* * Include file headers */ diff --git a/main.cpp b/main.cpp index f017023..bea3fd3 100644 --- a/main.cpp +++ b/main.cpp @@ -199,10 +199,15 @@ vec2 offset; * of milliseconds that have passed sine the epoch. * */ + +#ifdef __WIN32__ +#define millis() SDL_GetTicks() +#else unsigned int millis(void){ std::chrono::system_clock::time_point now=std::chrono::system_clock::now(); return std::chrono::duration_cast(now.time_since_epoch()).count(); } +#endif typedef enum { SUNNY = 0, @@ -237,10 +242,10 @@ int main(int argc, char *argv[]){ // Run SDL_Quit when main returns atexit(SDL_Quit); - /*Untitled + /* * (Attempt to) Initialize SDL_image libraries with IMG_INIT_PNG so that we can load PNG * textures for the entities and stuff. - * Untitled + * */ if(!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)){ @@ -313,7 +318,9 @@ int main(int argc, char *argv[]){ */ GLenum err; +#ifndef __WIN32__ glewExperimental = GL_TRUE; +#endif if((err=glewInit()) != GLEW_OK){ std::cout << "GLEW was not able to initialize! Error: " << glewGetErrorString(err) << std::endl; return -1; -- cgit v1.2.3