created physics objects

This commit is contained in:
Solomon W. 2020-05-29 14:06:26 -04:00
parent f066dc1760
commit 82169f744c
2 changed files with 26 additions and 0 deletions

15
src/phys_obj.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "phys_obj.h"
phys_obj::phys_obj(Quad object, Vector init_vel) {
this->obj=object;
this->velocity=init_vel;
this->bounds=BoundingBox(object);
}
void phys_obj::force(Vector vec) {
this->velocity.x += vec.x;
this->velocity.y += vec.y;
}
void phys_obj::render(SDL_Renderer *rend) {
obj.render(rend);
bounds.render(rend);
}

11
src/phys_obj.h Normal file
View File

@ -0,0 +1,11 @@
#include "BoundingBox.h"
class phys_obj {
public:
Vector velocity;
Quad obj;
BoundingBox bounds;
phys_obj(Quad object, Vector init_vel);
void force(Vector vec);
void render(SDL_Renderer *rend);
};