]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
win32 build
authorClyne Sullivan <tullivan99@gmail.com>
Fri, 30 Oct 2015 15:45:31 +0000 (11:45 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Fri, 30 Oct 2015 15:45:31 +0000 (11:45 -0400)
Makefile
freetype6.dll [new file with mode: 0644]
glew32.dll [new file with mode: 0644]
include/common.h
main.cpp

index 8ac3b3d95fcd12591536b5ecda185b0e81ec559a..bbeff1eef73ef30286d5f2cb17134c82ffbd1b15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
 LIBS = -lGL -lGLEW -lSDL2main -lSDL2 -lfreetype -lSDL2_image -lSDL2_mixer\r
 \r
+WIN_LIBS = -lopengl32 -lglew32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -lfreetype\r
+\r
 FLAGS = -m32 -std=c++11 -Iinclude -Iinclude/freetype2\r
 \r
 all:\r
@@ -8,6 +10,9 @@ all:
        @echo "  CXX  main.cpp"\r
        @g++ $(FLAGS) -o main main.cpp out/*.o $(LIBS)\r
 \r
+win32:\r
+       @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS)\r
+       \r
 clean:\r
        @echo "  RM main"\r
        @-rm -f main\r
diff --git a/freetype6.dll b/freetype6.dll
new file mode 100644 (file)
index 0000000..e35edc6
Binary files /dev/null and b/freetype6.dll differ
diff --git a/glew32.dll b/glew32.dll
new file mode 100644 (file)
index 0000000..c9414c2
Binary files /dev/null and b/glew32.dll differ
index 359e82528eb943098cfb244cbaf7e67b3404f209..25d5abfabf2a555bdc763dc23fb17fc501bd127d 100644 (file)
@@ -14,6 +14,7 @@
  *     Include GLEW and the SDL 2 headers
 */
 
+#define GLEW_STATIC
 #include <GL/glew.h>
 
 #include <SDL2/SDL.h>
 #include <string>
 #include <fstream>
 
+#ifdef __WIN32__
+typedef unsigned int uint;
+#undef near
+#endif
+
 /*
  *     Include file headers
 */
index f017023c5b61647c51951f87eb766fcfbac3133e..bea3fd375a4db72c5467c857857361a4078a8338 100644 (file)
--- 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<std::chrono::milliseconds>(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;