]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Makefile supports 32 and 64 bit
authordrumsetmonkey <abelleisle@roadrunner.com>
Fri, 13 Nov 2015 17:51:07 +0000 (12:51 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Fri, 13 Nov 2015 17:51:07 +0000 (12:51 -0500)
Makefile
assets/player.png
assets/player1.png
assets/player2.png
include/world.h
main.cpp
src/Makefile
src/Texture.cpp
src/world.cpp

index 7a7a868ac273b0b1541dc144f286dba1c3b265cf..0de83cb429d22944430cb79cec6dd966d3f9c4df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,11 +4,18 @@ WIN_LIBS = -lopengl32 -lglew32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_m
 \r
 FLAGS = -std=c++11 -Iinclude -Iinclude/freetype2\r
 \r
+MFLAGS64 = 64\r
 all:\r
        @rm -f out/*.o\r
        @cd src; $(MAKE) $(MFLAGS)\r
        @echo "  CXX  main.cpp"\r
-       @g++ $(FLAGS) -o main main.cpp out/*.o $(LIBS)\r
+       @g++ $(FLAGS) -m32 -o main main.cpp out/*.o $(LIBS) -lSDL2main\r
+\r
+64:\r
+       @rm -f out64/*.o\r
+       @cd src; $(MAKE) $(MFLAGS64)\r
+       @echo "  CXX  main.cpp"\r
+       @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS)\r
 \r
 win32:\r
        @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS)\r
@@ -18,3 +25,5 @@ clean:
        @-rm -f main\r
        @echo "  RM out/*.o"\r
        @-rm -f out/*.o\r
+       @echo "  RM out64/*.o"\r
+       @-rm -f out64/*.o\r
index 708954bbacfcaf356cb85597196bfd4215100be2..88819801d863cdeab1d28efa8629847d075b1497 100644 (file)
Binary files a/assets/player.png and b/assets/player.png differ
index 5d8fbc68e5c4e9aadc1b780f2c075efa8c40f781..33e68f2d1fef7a668283ef3f083ab279035be744 100644 (file)
Binary files a/assets/player1.png and b/assets/player1.png differ
index 7f14884af3bfb884f514281644727f20b27f2a3a..20e679b647796bb5de34069f6896d12e40cbc643 100644 (file)
Binary files a/assets/player2.png and b/assets/player2.png differ
index 6b14f7ef4d7f32ea4e653672735238046fd07d2a..0d5c87ed224be9a3691f6b686d18885d71aacdd4 100644 (file)
@@ -80,7 +80,7 @@ public:
        
        //template<class T>
        //void getEntityLocation(std::vector<T*>&, unsigned int);
-
+       
        void addStructure(_TYPE t,float x,float y,World *outside,World *inside);
        void addMob(int t,float x,float y);
        void addNPC(float x,float y);
index 61aa3aee0a9c40d8a44525306a65258458b53be2..744ed1b9cdad8f50c13a753e574379b0dfdf0c54 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -214,7 +214,7 @@ typedef enum {
        RAIN
 } WEATHER;
 
-#define DAY_CYCLE 300
+#define DAY_CYCLE 3000
 
 static WEATHER weather = SUNNY;
 static vec2 star[100];
@@ -575,10 +575,9 @@ void render(){
        if(!worldInside){
                if(player->loc.x - SCREEN_WIDTH/2 < currentWorld->getTheWidth() * -0.5f)
                        offset.x = ((currentWorld->getTheWidth() * -0.5f) + SCREEN_WIDTH / 2) + player->width / 2;
-               if(player->loc.x + SCREEN_WIDTH/2 > currentWorld->getTheWidth() *  0.5f)
-                       offset.x = ((currentWorld->getTheWidth() *  0.5f) - SCREEN_WIDTH / 2) + player->width / 2;
+               if(player->loc.x + player->width + SCREEN_WIDTH/2 > currentWorld->getTheWidth() *  0.5f)
+                       offset.x = ((currentWorld->getTheWidth() *  0.5f) - SCREEN_WIDTH / 2);// + player->width / 2;
        }
-
        if(player->loc.y > SCREEN_HEIGHT/2)
                offset.y = player->loc.y + player->height;
 
index aacef575c2349860915b6724aaef5fba0becdca7..f40ab90a71f66e964e39fda497f82619ee95bcce 100644 (file)
@@ -3,9 +3,16 @@ LIBS = -lGL -lSDL2 -lSDL2_image -lSDL2_mixer -lfreetype
 FLAGS = -std=c++11 -I../include -I../include/freetype2
 
 OUT = `echo "" $$(ls -c $(wildcard *.cpp)) | sed s/.cpp/.o/g | sed 's/ / ..\/out\//g'`
+OUT64 = `echo "" $$(ls -c $(wildcard *.cpp)) | sed s/.cpp/.o/g | sed 's/ / ..\/out64\//g'`
 
 ../out/%.o:
        @echo "  CXX " $(shell echo $@ | sed 's/..\/out\///g' | sed 's/\.o/\.cpp/')
-       @g++ $(FLAGS) -o $@ -c $(shell echo $@ | sed 's/..\/out\///g' | sed 's/\.o/\.cpp/') $(LIBS)
+       @g++ $(FLAGS) -m32 -o $@ -c $(shell echo $@ | sed 's/..\/out\///g' | sed 's/\.o/\.cpp/') $(LIBS) -lSDL2main
+
+../out64/%.o:
+       @echo "  CXX " $(shell echo $@ | sed 's/..\/out64\///g' | sed 's/\.o/\.cpp/')
+       @g++ $(FLAGS) -m64 -o $@ -c $(shell echo $@ | sed 's/..\/out64\///g' | sed 's/\.o/\.cpp/') $(LIBS)
 
 all: $(shell echo $(OUT))
+
+64: $(shell echo $(OUT64))
index 99d6ae723b5eed16c7b2ab5efae1c41be256fb25..01a19aa4a3590695e738b8da2f7645cb848e5cb9 100644 (file)
@@ -10,6 +10,7 @@ namespace Texture{
 
                glGenTextures(1, &object); //turns "object" into a texture
                glBindTexture(GL_TEXTURE_2D, object); //binds "object" to the top of the stack
+               glPixelStoref(GL_UNPACK_ALIGNMENT,1 );
 
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //sets the "min" filter
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //the the "max" filter of the stack
@@ -17,7 +18,15 @@ namespace Texture{
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); //Wrap the texture to the matrix
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //Wrap the texutre to the matrix
 
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image->w, image->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); //sets the texture to the image file loaded above
+               glTexImage2D(   GL_TEXTURE_2D, 
+                                               0, 
+                                           GL_RGBA,
+                                           image->w,
+                                           image->h, 
+                                           0, 
+                                           GL_RGBA, 
+                                           GL_UNSIGNED_BYTE, 
+                                           image->pixels); //sets the texture to the image file loaded above
 
                SDL_FreeSurface(image); //Free surface
                return object;
index 8c51af08530e8a46de11771c1ec50f935e157a78..f343152e42f0fd182cf6165dc25c2616e69a8d66 100644 (file)
@@ -569,7 +569,7 @@ void World::getEntityLocation(std::vector<T*>&vecBuf, unsigned int n){
                i++;
        }
 }*/
-
+       
 void World::addMob(int t,float x,float y){
        mob.push_back(new Mob(t));
        mob.back()->spawn(x,y);