From 2efd19fa9cd3d24538242cbea828830ac07c324f Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 13 Nov 2015 12:51:07 -0500 Subject: [PATCH] Makefile supports 32 and 64 bit --- Makefile | 11 ++++++++++- assets/player.png | Bin 566 -> 577 bytes assets/player1.png | Bin 586 -> 586 bytes assets/player2.png | Bin 590 -> 586 bytes include/world.h | 2 +- main.cpp | 7 +++---- src/Makefile | 9 ++++++++- src/Texture.cpp | 11 ++++++++++- src/world.cpp | 2 +- 9 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7a7a868..0de83cb 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,18 @@ WIN_LIBS = -lopengl32 -lglew32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_m FLAGS = -std=c++11 -Iinclude -Iinclude/freetype2 +MFLAGS64 = 64 all: @rm -f out/*.o @cd src; $(MAKE) $(MFLAGS) @echo " CXX main.cpp" - @g++ $(FLAGS) -o main main.cpp out/*.o $(LIBS) + @g++ $(FLAGS) -m32 -o main main.cpp out/*.o $(LIBS) -lSDL2main + +64: + @rm -f out64/*.o + @cd src; $(MAKE) $(MFLAGS64) + @echo " CXX main.cpp" + @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS) win32: @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS) @@ -18,3 +25,5 @@ clean: @-rm -f main @echo " RM out/*.o" @-rm -f out/*.o + @echo " RM out64/*.o" + @-rm -f out64/*.o diff --git a/assets/player.png b/assets/player.png index 708954bbacfcaf356cb85597196bfd4215100be2..88819801d863cdeab1d28efa8629847d075b1497 100644 GIT binary patch delta 505 zcmVy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G` z2j2?~4LJryIaW%MTP%O2NklK+pmY&Oq2Iy5 z!9fsla4I6j&B1RWIEqU_&`BNq24bBAE4B&_*EpOhCSJI^(sDWKe|s+>$?x*=?j?>8 zf+%tvM*s*RoFKoH-fq$m2`LkmbZdDkkWl*Leu2b@9n&7`q}_k&^!hoF+#cdyk%o~c zPuwq36M1^}Sgu&MOIttJrhbXv9i(>{`{gTP*-8kAA=Ed{!Yd<@n@@^%aIi zwU*}0kB^v0I=D3QHV^ME}sxY zYA>-Q-Edt1<|cn9m3B#P((K0<0C%2eIk8TvOD7N0QN12WZf}(-b?$jSagQcWjCk-S z&h%?w8O`Y-E*_Q@duM3|fR*)Qe&_BmU0v)d`9Yp%`-oS62>+wHQ+4JWid}nX0#I7a z`Hp&8h-K8tDAYB!FcN9t`*vG71@`})^cBjgvlMdz>nc5v$ge(~XdT#dd^_RB@~4;B vM3gJ#0ch6V6x+J{ap>Jif1B)9))0RKbEnC89!q}L00000NkvXXu0mjf(F)|0 delta 494 zcmVA$hb+g5SQ?W%liXx(;pmY&O;l6`| zgM%RAEF#6NL%)UKC@uw|n>hFl#CCG1a4n@n8;5J8376g#TAHK&mg9Ys%bVx&=Fi0; zzQpM182lK@LzQAda^jMnAFKmVYqXR?>6g;WO);z_7GXrwYV3atIMx!+gfxoW3gWqt zn#hwg#Vm5zy71! kcKsj6zRR3-tc4N(0u?fq1ZWa2<^TWy07*qoM6N<$f?;Xsw*UYD diff --git a/assets/player1.png b/assets/player1.png index 5d8fbc68e5c4e9aadc1b780f2c075efa8c40f781..33e68f2d1fef7a668283ef3f083ab279035be744 100644 GIT binary patch delta 20 ccmX@ba*Aa_5GOY;ucg9tlgryTM!#nS07hL0R{#J2 delta 20 ccmX@ba*Aa_5GNNqw}#GaZq8R5qu(K+pmY&Oq2Iy5!9fsla4I6j&B1RWIEqU_&`BNq2I6%Rtk_d_JmITe4M@ST)MpdsjMM>2PLW5^)Wap Qa{vGU07*qoM6N<$f(E7Lk^lez delta 478 zcmV<40U`d%1kMDIQV9wN3=1CUIysJ!TP%OFNklA$OPTH#IRIG@j zC?a$elrG{Z^gB2>I0zyRPDP}+IruFEM{y|#I;n%-K&+Esi>-pgH4be`6E9w?EtgY& zTi%3Ro_qh~B|=I`ClW$P04b&Lvn!eNHVqJx;+>LiEKc|mDtotoAT(lO^RY?#T^)a4 zKKhcoL)Xw|VJOF!!`QcgL5!p1EJHn6DU1CML7K;HelS+SS^NQT2>DPAvZamL%Vw2RANgkwwQpuOx-7Zt< z)bkp|J^FBH#DDL@@qTTrqB%Omnf;tL-ddOfU}^P`_Szk!i?eO5KB# //void getEntityLocation(std::vector&, 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); diff --git a/main.cpp b/main.cpp index 61aa3ae..744ed1b 100644 --- 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; diff --git a/src/Makefile b/src/Makefile index aacef57..f40ab90 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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)) diff --git a/src/Texture.cpp b/src/Texture.cpp index 99d6ae7..01a19aa 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -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; diff --git a/src/world.cpp b/src/world.cpp index 8c51af0..f343152 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -569,7 +569,7 @@ void World::getEntityLocation(std::vector&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); -- 2.39.5