This commit is contained in:
Solomon W. 2020-06-04 23:13:09 -04:00
parent 356f646f95
commit de95a6317e
8 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,5 @@
CC = clang CC = clang
LINK = -lstdc++ -lSDL2 -lm -ldl -lSDL_gfx LINK = -lstdc++ -lSDL2 -lm -ldl #-lSDL_gfx
DBG = -Wall -g -gmodules -O0 DBG = -Wall -g -gmodules -O0
CC += $(DBG) CC += $(DBG)

View File

@ -1,6 +1,8 @@
#ifndef BOUND
#define BOUND
#include <cstddef> #include <cstddef>
#include "Quad.h" #include "Quad.h"
class BoundingBox { class BoundingBox {
private: private:
size_t parent; size_t parent;
@ -41,4 +43,5 @@ class BoundingBox {
BoundingBox(); BoundingBox();
void update(); void update();
void render(SDL_Renderer *rend); void render(SDL_Renderer *rend);
}; };
#endif

View File

@ -1,10 +1,11 @@
#ifndef CIRCLE
#define CIRCLE
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <cmath> #include <cmath>
#include "Vector.h" #include "Vector.h"
#include "Color.h" #include "Color.h"
#ifndef CIRCLE
#define CIRCLE
class Circle { class Circle {
private: private:
int testpoint(int x,int y) { int testpoint(int x,int y) {

View File

@ -1,7 +1,6 @@
#include <stdint.h>
#ifndef COLOR #ifndef COLOR
#define COLOR #define COLOR
#include <stdint.h>
#ifndef RED #ifndef RED
#define RED 255,0,0,255 #define RED 255,0,0,255

View File

@ -96,4 +96,4 @@ bool Quad::isInitialized() {
} else { } else {
return false; return false;
} }
}*/ }*/

View File

@ -1,3 +1,5 @@
#ifndef QUAD
#define QUAD
#include <vector> #include <vector>
#include "SDL2/SDL.h" #include "SDL2/SDL.h"
#include "Vector.h" #include "Vector.h"
@ -17,4 +19,5 @@ class Quad {
void render(SDL_Renderer *renderer); void render(SDL_Renderer *renderer);
void translate(Vector vec); void translate(Vector vec);
//bool isInitialized(); //bool isInitialized();
}; };
#endif

View File

@ -1,3 +1,6 @@
#ifndef WINDOW
#define WINDOW
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_timer.h> #include <SDL2/SDL_timer.h>
#include "Color.h" #include "Color.h"
@ -12,3 +15,4 @@ class Window {
void setClearColor(Color c); void setClearColor(Color c);
void setClearColor(Uint8 r,Uint8 g,Uint8 b,Uint8 a); void setClearColor(Uint8 r,Uint8 g,Uint8 b,Uint8 a);
}; };
#endif

View File

@ -1,3 +1,6 @@
#ifndef PHYS
#define PHYS
#include "BoundingBox.h" #include "BoundingBox.h"
#include "Circle.h" #include "Circle.h"
#include <vector> #include <vector>
@ -7,7 +10,7 @@ class phys_obj {
Vector velocity; Vector velocity;
Circle obj; Circle obj;
BoundingBox bounds; BoundingBox bounds;
bool contact_floor; bool contact_floor;
phys_obj(); phys_obj();
phys_obj(Circle c); phys_obj(Circle c);
phys_obj(Circle c, Vector init_vel); phys_obj(Circle c, Vector init_vel);
@ -16,7 +19,8 @@ class phys_obj {
static void calculate_vectors(std::vector<phys_obj> *objects, Vector win_dim); static void calculate_vectors(std::vector<phys_obj> *objects, Vector win_dim);
void translate(Vector vec); void translate(Vector vec);
bool checkCollision(phys_obj o); bool checkCollision(phys_obj o);
float angleTo(phys_obj o); float angleTo(phys_obj o);
int distanceTo(Circle c); int distanceTo(Circle c);
void setPosition(Vector vec); void setPosition(Vector vec);
}; };
#endif