aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-06 20:09:09 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-06 20:09:09 +0100
commit81de5e68ba6cf5cd8bc64c3fc0eecef84c417b61 (patch)
tree144b0e9efecd4c10d6d79a17b4bf571336d45961 /src/crepe/system
parent5eedba3a070c3a7a4f27ae3ec7dd41812695f7e9 (diff)
parentfdb4c99e139a264d4e15e6913a3756fc6cccb2f2 (diff)
Merge branch 'master' into niels/decoupling_pixel_and_pos
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/CollisionSystem.h65
-rw-r--r--src/crepe/system/ParticleSystem.h10
-rw-r--r--src/crepe/system/PhysicsSystem.h4
-rw-r--r--src/crepe/system/RenderSystem.cpp3
-rw-r--r--src/crepe/system/RenderSystem.h8
-rw-r--r--src/crepe/system/ScriptSystem.h2
6 files changed, 46 insertions, 46 deletions
diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h
index 7e893c8..5b136c6 100644
--- a/src/crepe/system/CollisionSystem.h
+++ b/src/crepe/system/CollisionSystem.h
@@ -37,7 +37,7 @@ private:
/**
* \brief A structure to store the collision data of a single collider.
- *
+ *
* This structure all components and id that are for needed within this system when calculating or handeling collisions.
* The transform and rigidbody are mostly needed for location and rotation.
* In rigidbody additional info is written about what the body of the object is,
@@ -65,7 +65,7 @@ private:
public:
/**
* \brief Structure representing detailed collision information between two colliders.
- *
+ *
* Includes information about the colliding objects and the resolution data for handling the collision.
*/
struct CollisionInfo {
@@ -90,9 +90,9 @@ public:
private:
/**
* \brief Determines the type of collider pair from two colliders.
- *
+ *
* Uses std::holds_alternative to identify the types of the provided colliders.
- *
+ *
* \param collider1 First collider variant (BoxCollider or CircleCollider).
* \param collider2 Second collider variant (BoxCollider or CircleCollider).
* \return The combined type of the two colliders.
@@ -102,9 +102,9 @@ private:
/**
* \brief Calculates the current position of a collider.
- *
+ *
* Combines the Collider offset, Transform position, and Rigidbody offset to compute the position of the collider.
- *
+ *
* \param collider_offset The offset of the collider.
* \param transform The Transform of the associated game object.
* \param rigidbody The Rigidbody of the associated game object.
@@ -116,9 +116,9 @@ private:
private:
/**
* \brief Handles collision resolution between two colliders.
- *
+ *
* Processes collision data and adjusts objects to resolve collisions and/or calls the user oncollision script function.
- *
+ *
* \param data1 Collision data for the first collider.
* \param data2 Collision data for the second collider.
*/
@@ -126,9 +126,9 @@ private:
/**
* \brief Resolves collision between two colliders and calculates the movement required.
- *
+ *
* Determines the displacement and direction needed to separate colliders based on their types.
- *
+ *
* \param data1 Collision data for the first collider.
* \param data2 Collision data for the second collider.
* \param type The type of collider pair.
@@ -140,9 +140,9 @@ private:
/**
* \brief Calculates the resolution vector for two BoxColliders.
- *
+ *
* Computes the displacement required to separate two overlapping BoxColliders.
- *
+ *
* \param box_collider1 The first BoxCollider.
* \param box_collider2 The second BoxCollider.
* \param position1 The position of the first BoxCollider.
@@ -155,13 +155,13 @@ private:
/**
* \brief Calculates the resolution vector for two CircleCollider.
- *
+ *
* Computes the displacement required to separate two overlapping CircleCollider.
- *
+ *
* \param circle_collider1 The first CircleCollider.
* \param circle_collider2 The second CircleCollider.
- * \param position1 The position of the first CircleCollider.
- * \param position2 The position of the second CircleCollider.
+ * \param final_position1 The position of the first CircleCollider.
+ * \param final_position2 The position of the second CircleCollider.
* \return The resolution vector for the collision.
*/
vec2 get_circle_circle_resolution(const CircleCollider & circle_collider1,
@@ -171,14 +171,13 @@ private:
/**
* \brief Calculates the resolution vector for two CircleCollider.
- *
+ *
* Computes the displacement required to separate two overlapping CircleCollider.
- *
+ *
* \param circle_collider The first CircleCollider.
* \param box_collider The second CircleCollider.
* \param circle_position The position of the CircleCollider.
* \param box_position The position of the BoxCollider.
- * \param inverse Inverted true if box circle collision, false if circle box collision (inverts the direction).
* \return The resolution vector for the collision.
*/
vec2 get_circle_box_resolution(const CircleCollider & circle_collider,
@@ -188,18 +187,18 @@ private:
/**
* \brief Determines the appropriate collision handler for a collision.
- *
+ *
* Decides the correct resolution process based on the dynamic or static nature of the colliders involved.
- *
+ *
* \param info Collision information containing data about both colliders.
*/
void determine_collision_handler(CollisionInfo & info);
/**
* \brief Handles collisions involving static objects.
- *
+ *
* Resolves collisions by adjusting positions and modifying velocities if bounce is enabled.
- *
+ *
* \param info Collision information containing data about both colliders.
*/
void static_collision_handler(CollisionInfo & info);
@@ -207,9 +206,9 @@ private:
private:
/**
* \brief Checks for collisions between colliders.
- *
+ *
* Identifies collisions and generates pairs of colliding objects for further processing.
- *
+ *
* \param colliders A collection of all active colliders.
* \return A list of collision pairs with their associated data.
*/
@@ -218,13 +217,13 @@ private:
/**
* \brief Checks if two collision layers have at least one common layer.
- *
+ *
* This function checks if there is any overlapping layer between the two inputs.
- * It compares each layer from the first input to see
- * if it exists in the second input. If at least one common layer is found,
- * the function returns true, indicating that the two colliders share a common
+ * It compares each layer from the first input to see
+ * if it exists in the second input. If at least one common layer is found,
+ * the function returns true, indicating that the two colliders share a common
* collision layer.
- *
+ *
* \param layers1 all collision layers for the first collider.
* \param layers2 all collision layers for the second collider.
* \return Returns true if there is at least one common layer, false otherwise.
@@ -234,9 +233,9 @@ private:
/**
* \brief Checks for collision between two colliders.
- *
+ *
* Calls the appropriate collision detection function based on the collider types.
- *
+ *
* \param first_info Collision data for the first collider.
* \param second_info Collision data for the second collider.
* \param type The type of collider pair.
@@ -248,7 +247,7 @@ private:
/**
* \brief Detects collisions between two BoxColliders.
- *
+ *
* \param box1 The first BoxCollider.
* \param box2 The second BoxCollider.
* \param transform1 Transform of the first object.
diff --git a/src/crepe/system/ParticleSystem.h b/src/crepe/system/ParticleSystem.h
index c647284..068f01c 100644
--- a/src/crepe/system/ParticleSystem.h
+++ b/src/crepe/system/ParticleSystem.h
@@ -25,7 +25,7 @@ public:
private:
/**
* \brief Emits a particle from the specified emitter based on its emission properties.
- *
+ *
* \param emitter Reference to the ParticleEmitter.
* \param transform Const reference to the Transform component associated with the emitter.
*/
@@ -34,7 +34,7 @@ private:
/**
* \brief Calculates the number of times particles should be emitted based on emission rate
* and update count.
- *
+ *
* \param count Current update count.
* \param emission Emission rate.
* \return The number of particles to emit.
@@ -44,7 +44,7 @@ private:
/**
* \brief Checks whether particles are within the emitter’s boundary, resets or stops
* particles if they exit.
- *
+ *
* \param emitter Reference to the ParticleEmitter.
* \param transform Const reference to the Transform component associated with the emitter.
*/
@@ -52,7 +52,7 @@ private:
/**
* \brief Generates a random angle for particle emission within the specified range.
- *
+ *
* \param min_angle Minimum emission angle in degrees.
* \param max_angle Maximum emission angle in degrees.
* \return Random angle in degrees.
@@ -61,7 +61,7 @@ private:
/**
* \brief Generates a random speed for particle emission within the specified range.
- *
+ *
* \param min_speed Minimum emission speed.
* \param max_speed Maximum emission speed.
* \return Random speed.
diff --git a/src/crepe/system/PhysicsSystem.h b/src/crepe/system/PhysicsSystem.h
index 227ab69..26152a5 100644
--- a/src/crepe/system/PhysicsSystem.h
+++ b/src/crepe/system/PhysicsSystem.h
@@ -6,7 +6,7 @@ namespace crepe {
/**
* \brief System that controls all physics
- *
+ *
* This class is a physics system that uses a rigidbody and transform to add physics to a game
* object.
*/
@@ -15,7 +15,7 @@ public:
using System::System;
/**
* \brief updates the physics system.
- *
+ *
* It calculates new velocties and changes the postion in the transform.
*/
void update() override;
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 830d380..26f2c85 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -46,7 +46,8 @@ SDLContext::CameraValues RenderSystem::update_camera() {
}
bool sorting_comparison(const Sprite & a, const Sprite & b) {
- if (a.data.sorting_in_layer != b.data.sorting_in_layer) return a.data.sorting_in_layer < b.data.sorting_in_layer;
+ if (a.data.sorting_in_layer != b.data.sorting_in_layer)
+ return a.data.sorting_in_layer < b.data.sorting_in_layer;
if (a.data.order_in_layer != b.data.order_in_layer)
return a.data.order_in_layer < b.data.order_in_layer;
diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h
index de76229..e270a6b 100644
--- a/src/crepe/system/RenderSystem.h
+++ b/src/crepe/system/RenderSystem.h
@@ -18,7 +18,7 @@ class Transform;
* \brief Manages rendering operations for all game objects.
*
* RenderSystem is responsible for rendering, clearing and presenting the screen, and
- * managing the active camera.
+ * managing the active camera.
*/
class RenderSystem : public System {
public:
@@ -56,10 +56,10 @@ private:
const double & scale);
/**
- * \brief renders a sprite with a Transform component on the screen
+ * \brief renders a sprite with a Transform component on the screen
*
* \param sprite the sprite component that holds all the data
- * \param tm the Transform component that holds the position,rotation and scale
+ * \param tm the Transform component that holds the position,rotation and scale
*/
void render_normal(const Sprite & sprite, const SDLContext::CameraValues & cam,
const Transform & tm);
@@ -67,7 +67,7 @@ private:
/**
* \brief sort a vector sprite objects with
*
- * \param objs the vector that will do a sorting algorithm on
+ * \param objs the vector that will do a sorting algorithm on
* \return returns a sorted reference vector
*/
RefVector<Sprite> sort(RefVector<Sprite> & objs) const;
diff --git a/src/crepe/system/ScriptSystem.h b/src/crepe/system/ScriptSystem.h
index 936e9ca..3db1b1e 100644
--- a/src/crepe/system/ScriptSystem.h
+++ b/src/crepe/system/ScriptSystem.h
@@ -8,7 +8,7 @@ class Script;
/**
* \brief Script system
- *
+ *
* The script system is responsible for all \c BehaviorScript components, and
* calls the methods on classes derived from \c Script.
*/