mirror of
https://github.com/PoetryInCode/simple-rigid-sim.git
synced 2025-04-19 18:17:14 -04:00
created physics objects
This commit is contained in:
parent
f066dc1760
commit
82169f744c
15
src/phys_obj.cpp
Normal file
15
src/phys_obj.cpp
Normal 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
11
src/phys_obj.h
Normal 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);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user