diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-10 21:38:58 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-10 21:38:58 +0100 |
commit | 47dd27c42f375b65ee53f8b1e8c1b25327315a92 (patch) | |
tree | c3206a49e7826e4e6f8a506e0d596d58393c2d6b /src/crepe/api | |
parent | 428182f45797de73b0bc2335916d25762b0d719b (diff) |
box-box collision
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/BoxCollider.cpp | 5 | ||||
-rw-r--r-- | src/crepe/api/BoxCollider.h | 2 | ||||
-rw-r--r-- | src/crepe/api/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/crepe/api/CircleCollider.cpp | 2 | ||||
-rw-r--r-- | src/crepe/api/CircleCollider.h | 1 | ||||
-rw-r--r-- | src/crepe/api/Rigidbody.h | 2 |
6 files changed, 10 insertions, 6 deletions
diff --git a/src/crepe/api/BoxCollider.cpp b/src/crepe/api/BoxCollider.cpp index c3cb60c..eafbdb2 100644 --- a/src/crepe/api/BoxCollider.cpp +++ b/src/crepe/api/BoxCollider.cpp @@ -1,8 +1,7 @@ -#pragma once - #include "BoxCollider.h" +#include "../Collider.h" using namespace crepe; -BoxCollider::BoxCollider(game_object_id_t game_object_id,Vector2 offset, int width, int height) : Collider(game_object_id,offset), width(width), height(height) {} +BoxCollider::BoxCollider(game_object_id_t game_object_id,Vector2 offset, double width, double height) : Collider(game_object_id,offset), width(width), height(height) {} diff --git a/src/crepe/api/BoxCollider.h b/src/crepe/api/BoxCollider.h index 2461636..357c979 100644 --- a/src/crepe/api/BoxCollider.h +++ b/src/crepe/api/BoxCollider.h @@ -7,7 +7,7 @@ namespace crepe { class BoxCollider : public Collider { public: - BoxCollider(game_object_id_t game_object_id,Vector2 offset, int width, int height); + BoxCollider(game_object_id_t game_object_id,Vector2 offset, double width, double height); double width; double height; }; diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index 87cbb09..6915074 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -18,6 +18,8 @@ target_sources(crepe PUBLIC Vector2.cpp Camera.cpp Animator.cpp + BoxCollider.cpp + CircleCollider.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES @@ -42,4 +44,6 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES SceneManager.hpp Camera.h Animator.h + BoxCollider.h + CircleCollider.h ) diff --git a/src/crepe/api/CircleCollider.cpp b/src/crepe/api/CircleCollider.cpp index 9365793..04a4995 100644 --- a/src/crepe/api/CircleCollider.cpp +++ b/src/crepe/api/CircleCollider.cpp @@ -1,5 +1,3 @@ -#pragma once - #include "CircleCollider.h" using namespace crepe; diff --git a/src/crepe/api/CircleCollider.h b/src/crepe/api/CircleCollider.h index 3a66355..29a9c1e 100644 --- a/src/crepe/api/CircleCollider.h +++ b/src/crepe/api/CircleCollider.h @@ -1,6 +1,7 @@ #pragma once #include "Vector2.h" + #include "../Collider.h" namespace crepe { diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h index 68481f4..b9edec2 100644 --- a/src/crepe/api/Rigidbody.h +++ b/src/crepe/api/Rigidbody.h @@ -75,6 +75,8 @@ public: bool use_gravity = true; //! if object bounces bool bounce = false; + //! offset of all colliders + Vector2 offset; }; public: |