diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2f8b2d9 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +#-*- Makefile -*- + +OBJS = main.o player.o dt.o block.o entity.o + +CC = x86_64-w64-mingw32-g++ + +COMPILER_FLAGS = -w + +LINKER_FLAGS = -lSDL2 -std=gnu++11 + +OBJ_NAME = main.exe + + +all: $(OBJS) + $(CC) $(OBJS) $(COMPLER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME) + +main.o: main.cpp + $(CC) -c main.cpp $(LINKER_FLAGS) + +player.o: player.cpp player.h entity.h + $(CC) -c player.cpp -lm $(LINKER_FLAGS) + +dt.o: dt.cpp dt.h + $(CC) -c dt.cpp $(LINKER_FLAGS) + +block.o: block.cpp block.h entity.h + $(CC) -c block.cpp $(LINKER_FLAGS) + +entity.o: entity.cpp entity.h + $(CC) -c entity.cpp $(LINKER_FLAGS) diff --git a/collisions.cpp b/collisions.cpp deleted file mode 100644 index fd53d9c..0000000 --- a/collisions.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//Collision checker class body - -#include"collisions.h" - -char check(SDL_Rect rectA, SDL_Rect rect2){ - - int collision; - - int aX = rectA.x; - int aY = rectA.y; - int a2X = rectA.x + rectA.w; - int a2Y = rectA.y + rectA.h; - - int bX = rectB.x; - int bY = rectB.y; - int b2X = rectB.x + rectB.w; - int b2Y = rectB.y + rectB.h; - - if(aX >= bX and aX <= b2X or a2X >= bX and a2X <= b2X) collision += 1; - if(aY >= bY and aY <= b2Y or a2Y >= bY and a2Y <= b2Y) collision += 2; - - return collision; -}; diff --git a/collisions.h b/collisions.h deleted file mode 100644 index f5ea866..0000000 --- a/collisions.h +++ /dev/null @@ -1,13 +0,0 @@ -//Collision checker class - -#ifndef __COLLISIONS_H_INCLUDED__ -#define __COLLISIONS_H_INCLUDED__ - -#include - -class checkCollisions{ - public: - char check(SDL_Rect rectA, SDL_Rect rectB); -} - -#endif diff --git a/core.cpp b/core.cpp deleted file mode 100644 index bddb6f1..0000000 --- a/core.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//Delta time class body - -#include"dt.h" - -DeltaTime::DeltaTime(){ - now = SDL_GetPerformanceCounter(); -}; - -float DeltaTime::getDt(){ - last = now; - now = SDL_GetPerformanceCounter(); - - dt = (now - last)/SDL_GetPerformanceFrequency(); - if(dt > 0.15f) dt = 0.15f; - - return dt; -}; diff --git a/core.h b/core.h deleted file mode 100644 index 92e7456..0000000 --- a/core.h +++ /dev/null @@ -1,13 +0,0 @@ -//Delta time class header - -#include - -class CUU{ - public: - CUU(); - float getDt(); - int rendererWidth(); - int rendererHeight(); - private: - float now, last, dt; -}; diff --git a/main.cpp b/main.cpp index 4b9d71e..205b8bc 100644 --- a/main.cpp +++ b/main.cpp @@ -32,7 +32,7 @@ bool loadMedia(){ void init(){ SDL_Init(SDL_INIT_VIDEO); //IMG_Init(IMG_INIT_JPG); - gWindow = SDL_CreateWindow("Plataform Test!",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_WINDOW_SHOWN); + gWindow = SDL_CreateWindow("Platform Test!",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_WINDOW_SHOWN); gRenderer = SDL_CreateRenderer(gWindow,-1,SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_SetRenderDrawColor(gRenderer,0xFF,0xFF,0xFF,0xFF); }