Minor changes
deleted unused files, included Makefile for Linux and corrected the title typo.
This commit is contained in:
parent
0723c37bbf
commit
174cab5983
|
@ -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)
|
|
@ -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;
|
|
||||||
};
|
|
13
collisions.h
13
collisions.h
|
@ -1,13 +0,0 @@
|
||||||
//Collision checker class
|
|
||||||
|
|
||||||
#ifndef __COLLISIONS_H_INCLUDED__
|
|
||||||
#define __COLLISIONS_H_INCLUDED__
|
|
||||||
|
|
||||||
#include<SDL2/SDL.h>
|
|
||||||
|
|
||||||
class checkCollisions{
|
|
||||||
public:
|
|
||||||
char check(SDL_Rect rectA, SDL_Rect rectB);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
17
core.cpp
17
core.cpp
|
@ -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;
|
|
||||||
};
|
|
13
core.h
13
core.h
|
@ -1,13 +0,0 @@
|
||||||
//Delta time class header
|
|
||||||
|
|
||||||
#include<SDL2/SDL.h>
|
|
||||||
|
|
||||||
class CUU{
|
|
||||||
public:
|
|
||||||
CUU();
|
|
||||||
float getDt();
|
|
||||||
int rendererWidth();
|
|
||||||
int rendererHeight();
|
|
||||||
private:
|
|
||||||
float now, last, dt;
|
|
||||||
};
|
|
2
main.cpp
2
main.cpp
|
@ -32,7 +32,7 @@ bool loadMedia(){
|
||||||
void init(){
|
void init(){
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
//IMG_Init(IMG_INIT_JPG);
|
//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);
|
gRenderer = SDL_CreateRenderer(gWindow,-1,SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
SDL_SetRenderDrawColor(gRenderer,0xFF,0xFF,0xFF,0xFF);
|
SDL_SetRenderDrawColor(gRenderer,0xFF,0xFF,0xFF,0xFF);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue