diff options
Diffstat (limited to 'src/crepe/api')
| -rw-r--r-- | src/crepe/api/Rigidbody.h | 44 | ||||
| -rw-r--r-- | src/crepe/api/Sprite.h | 10 | ||||
| -rw-r--r-- | src/crepe/api/Text.cpp | 2 | ||||
| -rw-r--r-- | src/crepe/api/Text.h | 2 | ||||
| -rw-r--r-- | src/crepe/api/Vector2.h | 3 | ||||
| -rw-r--r-- | src/crepe/api/Vector2.hpp | 5 | 
6 files changed, 52 insertions, 14 deletions
| diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h index 6900295..b63d941 100644 --- a/src/crepe/api/Rigidbody.h +++ b/src/crepe/api/Rigidbody.h @@ -2,6 +2,7 @@  #include <cmath>  #include <set> +#include <string>  #include "../Component.h" @@ -120,26 +121,49 @@ public:  		* above 0.0.  		*  		*/ -		float elastisity_coefficient = 0.0; +		float elasticity_coefficient = 0.0;  		/** -		* \brief Offset of all colliders relative to the object's transform position. +		 * \brief  Enables collision handling for objects colliding with kinematic objects. +		 * +		 * Enables collision handling for objects colliding with kinematic objects in the collision system. +     * If `kinematic_collision` is true, dynamic objects cannot pass through this kinematic object. +     * This ensures that kinematic objects delegate collision handling to the collision system. +		 */ +		bool kinematic_collision = true; + +		/** +		* \brief Defines the collision layers a GameObject interacts with.  		* -		* The `offset` defines a positional shift applied to all colliders associated with the object, relative to the object's -		* transform position. This allows for the colliders to be placed at a different position than the object's actual -		* position, without modifying the object's transform itself. +		* The `collision_layers` represent the set of layers the GameObject can detect collisions with. +		* Each element in this set corresponds to a layer ID. The GameObject will only collide with other +		* GameObjects that belong to one these layers. +		*/ +		std::set<int> collision_layers = {0}; + +		/** +		* \brief Specifies the collision layer of the GameObject.  		* +		* The `collision_layer` indicates the single layer that this GameObject belongs to.  +		* This determines which layers other objects must match to detect collisions with this object.  		*/ -		vec2 offset; +		int collision_layer = 0;  		/**  		 * \brief Defines the collision layers of a GameObject.  		 * -		 * The `collision_layers` specifies the layers that the GameObject will collide with. -		 * Each element represents a layer ID, and the GameObject will only detect -		 * collisions with other GameObjects that belong to these layers. +		 * The `collision_names` specifies where the GameObject will collide with. +		 * Each element represents a name from the Metadata of the gameobject.  		 */ -		std::set<int> collision_layers = {0}; +		std::set<std::string> collision_names; + +		/** +		 * \brief Defines the collision layers of a GameObject. +		 * +		 * The `collision_tags` specifies where the GameObject will collide with. +		 * Each element represents a tag from the Metadata of the gameobject. +		 */ +		std::set<std::string> collision_tags;  	};  public: diff --git a/src/crepe/api/Sprite.h b/src/crepe/api/Sprite.h index a2409c2..a3fc319 100644 --- a/src/crepe/api/Sprite.h +++ b/src/crepe/api/Sprite.h @@ -66,6 +66,16 @@ public:  		//! independent sprite offset position  		vec2 position_offset; + +		/** +		 * \brief gives the user the option to render this in world space or in camera space +		 * +		 * - if true will this be rendered in world space this means that the sprite can be +		 *   rendered off the screen  +		 * - if false --> will the sprite be rendered in camera space. this means that the +		 *   coordinates given on the \c Sprite and \c Transform will be inside the camera  +		 */ +		bool world_space = true;  	};  public: diff --git a/src/crepe/api/Text.cpp b/src/crepe/api/Text.cpp index 54a4370..4a94180 100644 --- a/src/crepe/api/Text.cpp +++ b/src/crepe/api/Text.cpp @@ -1,5 +1,3 @@ -#include "../facade/FontFacade.h" -  #include "Text.h"  using namespace crepe; diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h index c30dc80..da40141 100644 --- a/src/crepe/api/Text.h +++ b/src/crepe/api/Text.h @@ -3,8 +3,6 @@  #include <optional>  #include <string> -#include "../Component.h" -  #include "Asset.h"  #include "Color.h"  #include "UIObject.h" diff --git a/src/crepe/api/Vector2.h b/src/crepe/api/Vector2.h index bf9d124..52e1bb6 100644 --- a/src/crepe/api/Vector2.h +++ b/src/crepe/api/Vector2.h @@ -90,6 +90,9 @@ struct Vector2 {  	//! Returns the perpendicular vector to this vector.  	Vector2 perpendicular() const; + +	//! Checks if both components of the vector are NaN. +	bool is_nan() const;  };  } // namespace crepe diff --git a/src/crepe/api/Vector2.hpp b/src/crepe/api/Vector2.hpp index ff53cb0..e195760 100644 --- a/src/crepe/api/Vector2.hpp +++ b/src/crepe/api/Vector2.hpp @@ -163,4 +163,9 @@ Vector2<T> Vector2<T>::perpendicular() const {  	return {-y, x};  } +template <class T> +bool Vector2<T>::is_nan() const { +	return std::isnan(x) && std::isnan(y); +} +  } // namespace crepe |