From 82169f744c60021c7e54162139cffa038133e884 Mon Sep 17 00:00:00 2001 From: SoloArchx250 Date: Fri, 29 May 2020 14:06:26 -0400 Subject: [PATCH] created physics objects --- src/phys_obj.cpp | 15 +++++++++++++++ src/phys_obj.h | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/phys_obj.cpp create mode 100644 src/phys_obj.h diff --git a/src/phys_obj.cpp b/src/phys_obj.cpp new file mode 100644 index 0000000..8c83efd --- /dev/null +++ b/src/phys_obj.cpp @@ -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); +} \ No newline at end of file diff --git a/src/phys_obj.h b/src/phys_obj.h new file mode 100644 index 0000000..f0de28f --- /dev/null +++ b/src/phys_obj.h @@ -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); +}; \ No newline at end of file