diff options
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | assets/player.png | bin | 566 -> 577 bytes | |||
-rw-r--r-- | assets/player1.png | bin | 586 -> 586 bytes | |||
-rw-r--r-- | assets/player2.png | bin | 590 -> 586 bytes | |||
-rw-r--r-- | include/world.h | 2 | ||||
-rw-r--r-- | main.cpp | 7 | ||||
-rw-r--r-- | src/Makefile | 9 | ||||
-rw-r--r-- | src/Texture.cpp | 11 | ||||
-rw-r--r-- | src/world.cpp | 2 |
9 files changed, 33 insertions, 9 deletions
@@ -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 Binary files differindex 708954b..8881980 100644 --- a/assets/player.png +++ b/assets/player.png diff --git a/assets/player1.png b/assets/player1.png Binary files differindex 5d8fbc6..33e68f2 100644 --- a/assets/player1.png +++ b/assets/player1.png diff --git a/assets/player2.png b/assets/player2.png Binary files differindex 7f14884..20e679b 100644 --- a/assets/player2.png +++ b/assets/player2.png diff --git a/include/world.h b/include/world.h index 6b14f7e..0d5c87e 100644 --- a/include/world.h +++ b/include/world.h @@ -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); @@ -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<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); |