aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-15 20:39:07 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-15 20:39:07 +0100
commite8cd950b8ebd152d76d588d4fedc7f4c239b0835 (patch)
tree7919d13a79d52f1365bc19bf1b435a6264ee5512 /src/crepe/api
parent5bee4515c1089ce3499bc3b74780db94f0c02306 (diff)
parent9f6475e7b0698c414138e2a8140b47f01ce9c5d1 (diff)
merge `master` into `loek/cleanup`
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/Animator.h20
-rw-r--r--src/crepe/api/AssetManager.h25
-rw-r--r--src/crepe/api/AssetManager.hpp6
-rw-r--r--src/crepe/api/Camera.cpp4
-rw-r--r--src/crepe/api/Camera.h5
-rw-r--r--src/crepe/api/Config.h13
-rw-r--r--src/crepe/api/GameObject.cpp13
-rw-r--r--src/crepe/api/GameObject.h23
-rw-r--r--src/crepe/api/LoopTimer.cpp25
-rw-r--r--src/crepe/api/LoopTimer.h144
-rw-r--r--src/crepe/api/Metadata.h7
-rw-r--r--src/crepe/api/ParticleEmitter.cpp3
-rw-r--r--src/crepe/api/ParticleEmitter.h12
-rw-r--r--src/crepe/api/Rigidbody.h8
-rw-r--r--src/crepe/api/SaveManager.cpp9
-rw-r--r--src/crepe/api/SaveManager.h11
-rw-r--r--src/crepe/api/SceneManager.cpp9
-rw-r--r--src/crepe/api/Script.h7
-rw-r--r--src/crepe/api/Sprite.cpp4
-rw-r--r--src/crepe/api/Sprite.h11
-rw-r--r--src/crepe/api/Texture.h12
-rw-r--r--src/crepe/api/Transform.cpp3
-rw-r--r--src/crepe/api/Transform.h4
23 files changed, 172 insertions, 206 deletions
diff --git a/src/crepe/api/Animator.h b/src/crepe/api/Animator.h
index 3573403..53f4b91 100644
--- a/src/crepe/api/Animator.h
+++ b/src/crepe/api/Animator.h
@@ -9,11 +9,11 @@ class AnimatorSystem;
class SDLContext;
/**
- * \brief The Animator component is used to animate sprites by managing the movement
- * and frame changes within a sprite sheet.
+ * \brief The Animator component is used to animate sprites by managing the movement and frame
+ * changes within a sprite sheet.
*
- * This component allows for controlling sprite animation through rows and columns of a sprite sheet.
- * It can be used to play animations, loop them, or stop them.
+ * This component allows for controlling sprite animation through rows and columns of a sprite
+ * sheet. It can be used to play animations, loop them, or stop them.
*/
class Animator : public Component {
@@ -27,15 +27,17 @@ public:
* \brief Constructs an Animator object that will control animations for a sprite sheet.
*
* \param id The unique identifier for the component, typically assigned automatically.
- * \param spritesheet A reference to the Sprite object which holds the sprite sheet for animation.
+ * \param spritesheet A reference to the Sprite object which holds the sprite sheet for
+ * animation.
* \param row The maximum number of rows in the sprite sheet.
* \param col The maximum number of columns in the sprite sheet.
- * \param col__animate The specific col index of the sprite sheet to animate. This allows selecting which col to animate from multiple col in the sheet.
+ * \param col_animate The specific col index of the sprite sheet to animate. This allows
+ * selecting which col to animate from multiple col in the sheet.
*
- * This constructor sets up the Animator with the given parameters, and initializes the animation system.
+ * This constructor sets up the Animator with the given parameters, and initializes the
+ * animation system.
*/
- Animator(game_object_id_t id, Sprite & spritesheet, int row, int col,
- int col_animate);
+ Animator(uint32_t id, Sprite & spritesheet, int row, int col, int col_animate);
~Animator(); // dbg_trace
Animator(const Animator &) = delete;
diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h
index 86a9902..fee6780 100644
--- a/src/crepe/api/AssetManager.h
+++ b/src/crepe/api/AssetManager.h
@@ -8,13 +8,12 @@
namespace crepe {
/**
- * \brief The AssetManager is responsible for storing and managing assets over
- * multiple scenes.
+ * \brief The AssetManager is responsible for storing and managing assets over multiple scenes.
*
- * The AssetManager ensures that assets are loaded once and can be accessed
- * across different scenes. It caches assets to avoid reloading them every time
- * a scene is loaded. Assets are retained in memory until the AssetManager is
- * destroyed, at which point the cached assets are cleared.
+ * The AssetManager ensures that assets are loaded once and can be accessed across different
+ * scenes. It caches assets to avoid reloading them every time a scene is loaded. Assets are
+ * retained in memory until the AssetManager is destroyed, at which point the cached assets are
+ * cleared.
*/
class AssetManager {
@@ -44,20 +43,18 @@ public:
* \brief Caches an asset by loading it from the given file path.
*
* \param file_path The path to the asset file to load.
- * \param reload If true, the asset will be reloaded from the file, even if
- * it is already cached.
+ * \param reload If true, the asset will be reloaded from the file, even if it is already
+ * cached.
* \tparam T The type of asset to cache (e.g., texture, sound, etc.).
*
* \return A shared pointer to the cached asset.
*
- * This template function caches the asset at the given file path. If the
- * asset is already cached and `reload` is false, the existing cached version
- * will be returned. Otherwise, the asset will be reloaded and added to the
- * cache.
+ * This template function caches the asset at the given file path. If the asset is already
+ * cached and `reload` is false, the existing cached version will be returned. Otherwise, the
+ * asset will be reloaded and added to the cache.
*/
template <typename T>
- std::shared_ptr<T> cache(const std::string & file_path,
- bool reload = false);
+ std::shared_ptr<T> cache(const std::string & file_path, bool reload = false);
};
} // namespace crepe
diff --git a/src/crepe/api/AssetManager.hpp b/src/crepe/api/AssetManager.hpp
index 977b4e1..1c0e978 100644
--- a/src/crepe/api/AssetManager.hpp
+++ b/src/crepe/api/AssetManager.hpp
@@ -5,16 +5,14 @@
namespace crepe {
template <typename asset>
-std::shared_ptr<asset> AssetManager::cache(const std::string & file_path,
- bool reload) {
+std::shared_ptr<asset> AssetManager::cache(const std::string & file_path, bool reload) {
auto it = asset_cache.find(file_path);
if (!reload && it != asset_cache.end()) {
return std::any_cast<std::shared_ptr<asset>>(it->second);
}
- std::shared_ptr<asset> new_asset
- = std::make_shared<asset>(file_path.c_str());
+ std::shared_ptr<asset> new_asset = std::make_shared<asset>(file_path.c_str());
asset_cache[file_path] = new_asset;
diff --git a/src/crepe/api/Camera.cpp b/src/crepe/api/Camera.cpp
index 5835bdd..eb99f7f 100644
--- a/src/crepe/api/Camera.cpp
+++ b/src/crepe/api/Camera.cpp
@@ -6,9 +6,7 @@
using namespace crepe;
-Camera::Camera(game_object_id_t id, const Color & bg_color)
- : Component(id),
- bg_color(bg_color) {
+Camera::Camera(game_object_id_t id, const Color & bg_color) : Component(id), bg_color(bg_color) {
dbg_trace();
}
diff --git a/src/crepe/api/Camera.h b/src/crepe/api/Camera.h
index bf97731..e0cda34 100644
--- a/src/crepe/api/Camera.h
+++ b/src/crepe/api/Camera.h
@@ -9,9 +9,8 @@ namespace crepe {
* \class Camera
* \brief Represents a camera component for rendering in the game.
*
- * The Camera class defines the view parameters, including background color,
- * aspect ratio, position, and zoom level. It controls what part of the game
- * world is visible on the screen.
+ * The Camera class defines the view parameters, including background color, aspect ratio,
+ * position, and zoom level. It controls what part of the game world is visible on the screen.
*/
class Camera : public Component {
diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h
index 92b20b7..3ab877a 100644
--- a/src/crepe/api/Config.h
+++ b/src/crepe/api/Config.h
@@ -7,9 +7,9 @@ namespace crepe {
/**
* \brief Global configuration interface
*
- * This class stores engine default settings. Properties on this class are only
- * supposed to be modified *before* execution is handed over from the game
- * programmer to the engine (i.e. the main loop is started).
+ * This class stores engine default settings. Properties on this class are only supposed to be
+ * modified *before* execution is handed over from the game programmer to the engine (i.e. the
+ * main loop is started).
*/
class Config {
public:
@@ -31,8 +31,7 @@ public:
/**
* \brief Log level
*
- * Only messages with equal or higher severity than this value will be
- * logged.
+ * Only messages with equal or higher priority than this value will be logged.
*/
Log::Level level = Log::Level::INFO;
/**
@@ -48,8 +47,8 @@ public:
/**
* \brief Save file location
*
- * This location is used by the constructor of SaveManager, and should be
- * set before save manager functionality is attempted to be used.
+ * This location is used by the constructor of SaveManager, and should be set before save
+ * manager functionality is attempted to be used.
*/
std::string location = "save.crepe.db";
} savemgr;
diff --git a/src/crepe/api/GameObject.cpp b/src/crepe/api/GameObject.cpp
index 4f3c639..2b836e1 100644
--- a/src/crepe/api/GameObject.cpp
+++ b/src/crepe/api/GameObject.cpp
@@ -7,12 +7,7 @@
using namespace crepe;
using namespace std;
-GameObject::GameObject(ComponentManager & component_manager,
- game_object_id_t id, const std::string & name,
- const std::string & tag, const Vector2 & position,
- double rotation, double scale)
- : id(id),
- component_manager(component_manager) {
+GameObject::GameObject(ComponentManager & component_manager, game_object_id_t id, const std::string & name, const std::string & tag, const Vector2 & position, double rotation, double scale) : id(id), component_manager(component_manager) {
// Add Transform and Metadata components
ComponentManager & mgr = this->component_manager;
@@ -24,12 +19,10 @@ void GameObject::set_parent(const GameObject & parent) {
ComponentManager & mgr = this->component_manager;
// Set parent on own Metadata component
- vector<reference_wrapper<Metadata>> this_metadata
- = mgr.get_components_by_id<Metadata>(this->id);
+ vector<reference_wrapper<Metadata>> this_metadata = mgr.get_components_by_id<Metadata>(this->id);
this_metadata.at(0).get().parent = parent.id;
// Add own id to children list of parent's Metadata component
- vector<reference_wrapper<Metadata>> parent_metadata
- = mgr.get_components_by_id<Metadata>(parent.id);
+ vector<reference_wrapper<Metadata>> parent_metadata = mgr.get_components_by_id<Metadata>(parent.id);
parent_metadata.at(0).get().children.push_back(this->id);
}
diff --git a/src/crepe/api/GameObject.h b/src/crepe/api/GameObject.h
index 73ff0b8..cf6765a 100644
--- a/src/crepe/api/GameObject.h
+++ b/src/crepe/api/GameObject.h
@@ -12,15 +12,14 @@ class ComponentManager;
/**
* \brief Represents a GameObject
*
- * This class represents a GameObject. The GameObject class is only used
- * as an interface for the game programmer. The actual implementation is
- * done in the ComponentManager.
+ * This class represents a GameObject. The GameObject class is only used as an interface for
+ * the game programmer. The actual implementation is done in the ComponentManager.
*/
class GameObject {
private:
/**
- * This constructor creates a new GameObject. It creates a new
- * Transform and Metadata component and adds them to the ComponentManager.
+ * This constructor creates a new GameObject. It creates a new Transform and Metadata
+ * component and adds them to the ComponentManager.
*
* \param component_manager Reference to component_manager
* \param id The id of the GameObject
@@ -30,9 +29,7 @@ private:
* \param rotation The rotation of the GameObject
* \param scale The scale of the GameObject
*/
- GameObject(ComponentManager & component_manager, game_object_id_t id,
- const std::string & name, const std::string & tag,
- const Vector2 & position, double rotation, double scale);
+ GameObject(ComponentManager & component_manager, game_object_id_t id, const std::string & name, const std::string & tag, const Vector2 & position, double rotation, double scale);
//! ComponentManager instances GameObject
friend class ComponentManager;
@@ -40,9 +37,9 @@ public:
/**
* \brief Set the parent of this GameObject
*
- * This method sets the parent of this GameObject. It sets the parent
- * in the Metadata component of this GameObject and adds this GameObject
- * to the children list of the parent GameObject.
+ * This method sets the parent of this GameObject. It sets the parent in the Metadata
+ * component of this GameObject and adds this GameObject to the children list of the parent
+ * GameObject.
*
* \param parent The parent GameObject
*/
@@ -50,8 +47,8 @@ public:
/**
* \brief Add a component to the GameObject
*
- * This method adds a component to the GameObject. It forwards the
- * arguments to the ComponentManager.
+ * This method adds a component to the GameObject. It forwards the arguments to the
+ * ComponentManager.
*
* \tparam T The type of the component
* \tparam Args The types of the arguments
diff --git a/src/crepe/api/LoopTimer.cpp b/src/crepe/api/LoopTimer.cpp
index b3aec22..a9800b7 100644
--- a/src/crepe/api/LoopTimer.cpp
+++ b/src/crepe/api/LoopTimer.cpp
@@ -24,9 +24,8 @@ void LoopTimer::start() {
void LoopTimer::update() {
auto current_frame_time = std::chrono::steady_clock::now();
// Convert to duration in seconds for delta time
- this->delta_time
- = std::chrono::duration_cast<std::chrono::duration<double>>(
- current_frame_time - last_frame_time);
+ this->delta_time = std::chrono::duration_cast<std::chrono::duration<double>>(
+ current_frame_time - last_frame_time);
if (this->delta_time > this->maximum_delta_time) {
this->delta_time = this->maximum_delta_time;
@@ -39,17 +38,11 @@ void LoopTimer::update() {
double LoopTimer::get_delta_time() const { return this->delta_time.count(); }
-double LoopTimer::get_current_time() const {
- return this->elapsed_time.count();
-}
+double LoopTimer::get_current_time() const { return this->elapsed_time.count(); }
-void LoopTimer::advance_fixed_update() {
- this->elapsed_fixed_time += this->fixed_delta_time;
-}
+void LoopTimer::advance_fixed_update() { this->elapsed_fixed_time += this->fixed_delta_time; }
-double LoopTimer::get_fixed_delta_time() const {
- return this->fixed_delta_time.count();
-}
+double LoopTimer::get_fixed_delta_time() const { return this->fixed_delta_time.count(); }
void LoopTimer::set_fps(int fps) {
this->fps = fps;
@@ -66,13 +59,13 @@ void LoopTimer::enforce_frame_rate() {
std::chrono::steady_clock::time_point current_frame_time
= std::chrono::steady_clock::now();
std::chrono::milliseconds frame_duration
- = std::chrono::duration_cast<std::chrono::milliseconds>(
- current_frame_time - this->last_frame_time);
+ = std::chrono::duration_cast<std::chrono::milliseconds>(current_frame_time
+ - this->last_frame_time);
if (frame_duration < this->frame_target_time) {
std::chrono::milliseconds delay_time
- = std::chrono::duration_cast<std::chrono::milliseconds>(
- this->frame_target_time - frame_duration);
+ = std::chrono::duration_cast<std::chrono::milliseconds>(this->frame_target_time
+ - frame_duration);
if (delay_time.count() > 0) {
SDLContext::get_instance().delay(delay_time.count());
}
diff --git a/src/crepe/api/LoopTimer.h b/src/crepe/api/LoopTimer.h
index aff4bf7..f277d7b 100644
--- a/src/crepe/api/LoopTimer.h
+++ b/src/crepe/api/LoopTimer.h
@@ -7,117 +7,117 @@ namespace crepe {
class LoopTimer {
public:
/**
- * \brief Get the singleton instance of LoopTimer.
- *
- * \return A reference to the LoopTimer instance.
- */
+ * \brief Get the singleton instance of LoopTimer.
+ *
+ * \return A reference to the LoopTimer instance.
+ */
static LoopTimer & get_instance();
/**
- * \brief Get the current delta time for the current frame.
- *
- * \return Delta time in seconds since the last frame.
- */
+ * \brief Get the current delta time for the current frame.
+ *
+ * \return Delta time in seconds since the last frame.
+ */
double get_delta_time() const;
/**
- * \brief Get the current game time.
- *
- * \note The current game time may vary from real-world elapsed time.
- * It is the cumulative sum of each frame's delta time.
- *
- * \return Elapsed game time in seconds.
- */
+ * \brief Get the current game time.
+ *
+ * \note The current game time may vary from real-world elapsed time. It is the cumulative
+ * sum of each frame's delta time.
+ *
+ * \return Elapsed game time in seconds.
+ */
double get_current_time() const;
/**
- * \brief Set the target frames per second (FPS).
- *
- * \param fps The desired frames rendered per second.
- */
+ * \brief Set the target frames per second (FPS).
+ *
+ * \param fps The desired frames rendered per second.
+ */
void set_fps(int fps);
/**
- * \brief Get the current frames per second (FPS).
- *
- * \return Current FPS.
- */
+ * \brief Get the current frames per second (FPS).
+ *
+ * \return Current FPS.
+ */
int get_fps() const;
/**
- * \brief Get the current game scale.
- *
- * \return The current game scale, where 0 = paused, 1 = normal speed, and values > 1 speed up the game.
- */
+ * \brief Get the current game scale.
+ *
+ * \return The current game scale, where 0 = paused, 1 = normal speed, and values > 1 speed
+ * up the game.
+ */
double get_game_scale() const;
/**
- * \brief Set the game scale.
- *
- * \param game_scale The desired game scale (0 = pause, 1 = normal speed, > 1 = speed up).
- */
+ * \brief Set the game scale.
+ *
+ * \param game_scale The desired game scale (0 = pause, 1 = normal speed, > 1 = speed up).
+ */
void set_game_scale(double game_scale);
private:
friend class LoopManager;
/**
- * \brief Start the loop timer.
- *
- * Initializes the timer to begin tracking frame times.
- */
+ * \brief Start the loop timer.
+ *
+ * Initializes the timer to begin tracking frame times.
+ */
void start();
/**
- * \brief Enforce the frame rate limit.
- *
- * Ensures that the game loop does not exceed the target FPS by delaying
- * frame updates as necessary.
- */
+ * \brief Enforce the frame rate limit.
+ *
+ * Ensures that the game loop does not exceed the target FPS by delaying frame updates as
+ * necessary.
+ */
void enforce_frame_rate();
/**
- * \brief Get the fixed delta time for consistent updates.
- *
- * Fixed delta time is used for operations that require uniform time steps,
- * such as physics calculations.
- *
- * \return Fixed delta time in seconds.
- */
+ * \brief Get the fixed delta time for consistent updates.
+ *
+ * Fixed delta time is used for operations that require uniform time steps, such as physics
+ * calculations.
+ *
+ * \return Fixed delta time in seconds.
+ */
double get_fixed_delta_time() const;
/**
- * \brief Get the accumulated lag in the game loop.
- *
- * Lag represents the difference between the target frame time and the
- * actual frame time, useful for managing fixed update intervals.
- *
- * \return Accumulated lag in seconds.
- */
+ * \brief Get the accumulated lag in the game loop.
+ *
+ * Lag represents the difference between the target frame time and the actual frame time,
+ * useful for managing fixed update intervals.
+ *
+ * \return Accumulated lag in seconds.
+ */
double get_lag() const;
/**
- * \brief Construct a new LoopTimer object.
- *
- * Private constructor for singleton pattern to restrict instantiation
- * outside the class.
- */
+ * \brief Construct a new LoopTimer object.
+ *
+ * Private constructor for singleton pattern to restrict instantiation outside the class.
+ */
LoopTimer();
/**
- * \brief Update the timer to the current frame.
- *
- * Calculates and updates the delta time for the current frame and adds it to
- * the cumulative game time.
- */
+ * \brief Update the timer to the current frame.
+ *
+ * Calculates and updates the delta time for the current frame and adds it to the cumulative
+ * game time.
+ */
void update();
/**
- * \brief Advance the game loop by a fixed update interval.
- *
- * This method progresses the game state by a consistent, fixed time step,
- * allowing for stable updates independent of frame rate fluctuations.
- */
+ * \brief Advance the game loop by a fixed update interval.
+ *
+ * This method progresses the game state by a consistent, fixed time step, allowing for
+ * stable updates independent of frame rate fluctuations.
+ */
void advance_fixed_update();
private:
@@ -130,11 +130,9 @@ private:
//! Delta time for the current frame in seconds
std::chrono::duration<double> delta_time{0.0};
//! Target time per frame in seconds
- std::chrono::duration<double> frame_target_time
- = std::chrono::seconds(1) / fps;
+ std::chrono::duration<double> frame_target_time = std::chrono::seconds(1) / fps;
//! Fixed delta time for fixed updates in seconds
- std::chrono::duration<double> fixed_delta_time
- = std::chrono::seconds(1) / 50;
+ std::chrono::duration<double> fixed_delta_time = std::chrono::seconds(1) / 50;
//! Total elapsed game time in seconds
std::chrono::duration<double> elapsed_time{0.0};
//! Total elapsed time for fixed updates in seconds
diff --git a/src/crepe/api/Metadata.h b/src/crepe/api/Metadata.h
index c61e006..235d42f 100644
--- a/src/crepe/api/Metadata.h
+++ b/src/crepe/api/Metadata.h
@@ -10,8 +10,8 @@ namespace crepe {
/**
* \brief Metadata component
*
- * This class represents the Metadata component. It stores the name, tag, parent
- * and children of a GameObject.
+ * This class represents the Metadata component. It stores the name, tag, parent and children
+ * of a GameObject.
*/
class Metadata : public Component {
public:
@@ -20,8 +20,7 @@ public:
* \param name The name of the GameObject
* \param tag The tag of the GameObject
*/
- Metadata(game_object_id_t id, const std::string & name,
- const std::string & tag);
+ Metadata(game_object_id_t id, const std::string & name, const std::string & tag);
/**
* \brief Get the maximum number of instances for this component
*
diff --git a/src/crepe/api/ParticleEmitter.cpp b/src/crepe/api/ParticleEmitter.cpp
index 35f960d..90b77a0 100644
--- a/src/crepe/api/ParticleEmitter.cpp
+++ b/src/crepe/api/ParticleEmitter.cpp
@@ -2,8 +2,7 @@
using namespace crepe;
-ParticleEmitter::ParticleEmitter(game_object_id_t game_object_id,
- const Data & data)
+ParticleEmitter::ParticleEmitter(game_object_id_t game_object_id, const Data & data)
: Component(game_object_id),
data(data) {
for (size_t i = 0; i < this->data.max_particles; i++) {
diff --git a/src/crepe/api/ParticleEmitter.h b/src/crepe/api/ParticleEmitter.h
index a9e872f..33112e1 100644
--- a/src/crepe/api/ParticleEmitter.h
+++ b/src/crepe/api/ParticleEmitter.h
@@ -13,16 +13,16 @@ class Sprite;
/**
* \brief Data holder for particle emission parameters.
*
- * The ParticleEmitter class stores configuration data for particle properties,
- * defining the characteristics and boundaries of particle emissions.
+ * The ParticleEmitter class stores configuration data for particle properties, defining the
+ * characteristics and boundaries of particle emissions.
*/
class ParticleEmitter : public Component {
public:
/**
* \brief Defines the boundary within which particles are constrained.
*
- * This structure specifies the boundary's size and offset, as well as the
- * behavior of particles upon reaching the boundary limits.
+ * This structure specifies the boundary's size and offset, as well as the behavior of
+ * particles upon reaching the boundary limits.
*/
struct Boundary {
//! boundary width (midpoint is emitter location)
@@ -38,8 +38,8 @@ public:
/**
* \brief Holds parameters that control particle emission.
*
- * Contains settings for the emitter’s position, particle speed, angle, lifespan,
- * boundary, and the sprite used for rendering particles.
+ * Contains settings for the emitter’s position, particle speed, angle, lifespan, boundary,
+ * and the sprite used for rendering particles.
*/
struct Data {
//! position of the emitter
diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h
index 11544e5..3e5c7a3 100644
--- a/src/crepe/api/Rigidbody.h
+++ b/src/crepe/api/Rigidbody.h
@@ -9,8 +9,8 @@ namespace crepe {
/**
* \brief Rigidbody class
*
- * This class is used by the physics sytem and collision system.
- * It configures how to system interact with the gameobject for movement and collisions.
+ * This class is used by the physics sytem and collision system. It configures how to system
+ * interact with the gameobject for movement and collisions.
*/
class Rigidbody : public Component {
public:
@@ -30,8 +30,8 @@ public:
/**
* \brief PhysicsConstraints to constrain movement
*
- * This struct configures the movement constraint for this object.
- * If a constraint is enabled the systems will not move the object.
+ * This struct configures the movement constraint for this object. If a constraint is enabled
+ * the systems will not move the object.
*/
struct PhysicsConstraints {
//! X constraint
diff --git a/src/crepe/api/SaveManager.cpp b/src/crepe/api/SaveManager.cpp
index 2974b91..c5f43ea 100644
--- a/src/crepe/api/SaveManager.cpp
+++ b/src/crepe/api/SaveManager.cpp
@@ -139,14 +139,11 @@ ValueBroker<T> SaveManager::get(const string & key, const T & default_value) {
}
template ValueBroker<uint8_t> SaveManager::get(const string &, const uint8_t &);
template ValueBroker<int8_t> SaveManager::get(const string &, const int8_t &);
-template ValueBroker<uint16_t> SaveManager::get(const string &,
- const uint16_t &);
+template ValueBroker<uint16_t> SaveManager::get(const string &, const uint16_t &);
template ValueBroker<int16_t> SaveManager::get(const string &, const int16_t &);
-template ValueBroker<uint32_t> SaveManager::get(const string &,
- const uint32_t &);
+template ValueBroker<uint32_t> SaveManager::get(const string &, const uint32_t &);
template ValueBroker<int32_t> SaveManager::get(const string &, const int32_t &);
-template ValueBroker<uint64_t> SaveManager::get(const string &,
- const uint64_t &);
+template ValueBroker<uint64_t> SaveManager::get(const string &, const uint64_t &);
template ValueBroker<int64_t> SaveManager::get(const string &, const int64_t &);
template ValueBroker<float> SaveManager::get(const string &, const float &);
template ValueBroker<double> SaveManager::get(const string &, const double &);
diff --git a/src/crepe/api/SaveManager.h b/src/crepe/api/SaveManager.h
index 4be85fb..3d8c852 100644
--- a/src/crepe/api/SaveManager.h
+++ b/src/crepe/api/SaveManager.h
@@ -24,7 +24,8 @@ public:
* \brief Get a read/write reference to a value and initialize it if it does not yet exist
*
* \param key The value key
- * \param default_value Value to initialize \c key with if it does not already exist in the database
+ * \param default_value Value to initialize \c key with if it does not already exist in the
+ * database
*
* \return Read/write reference to the value
*/
@@ -38,8 +39,8 @@ public:
*
* \return Read/write reference to the value
*
- * \note Attempting to read this value before it is initialized (i.e. set)
- * will result in an exception
+ * \note Attempting to read this value before it is initialized (i.e. set) will result in an
+ * exception
*/
template <typename T>
ValueBroker<T> get(const std::string & key);
@@ -102,8 +103,8 @@ private:
*
* \returns DB instance
*
- * This function exists because DB is a facade class, which can't directly be
- * used in the API without workarounds
+ * This function exists because DB is a facade class, which can't directly be used in the API
+ * without workarounds
*
* TODO: better solution
*/
diff --git a/src/crepe/api/SceneManager.cpp b/src/crepe/api/SceneManager.cpp
index 4a38787..7fb5cb0 100644
--- a/src/crepe/api/SceneManager.cpp
+++ b/src/crepe/api/SceneManager.cpp
@@ -16,11 +16,10 @@ void SceneManager::load_next_scene() {
// next scene not set
if (this->next_scene.empty()) return;
- auto it
- = find_if(this->scenes.begin(), this->scenes.end(),
- [&next_scene = this->next_scene](unique_ptr<Scene> & scene) {
- return scene->name == next_scene;
- });
+ auto it = find_if(this->scenes.begin(), this->scenes.end(),
+ [&next_scene = this->next_scene](unique_ptr<Scene> & scene) {
+ return scene->name == next_scene;
+ });
// next scene not found
if (it == this->scenes.end()) return;
diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h
index 68a46d7..12ec7f1 100644
--- a/src/crepe/api/Script.h
+++ b/src/crepe/api/Script.h
@@ -34,10 +34,9 @@ protected:
* \c BehaviorScript component holding this script instance is active.
*/
virtual void update() {}
- // NOTE: additional *events* (like unity's OnDisable and OnEnable) should be
- // implemented as member methods in derivative user script classes and
- // registered in init(), otherwise this class will balloon in size with each
- // added event.
+ // NOTE: additional *events* (like unity's OnDisable and OnEnable) should be implemented as
+ // member methods in derivative user script classes and registered in init(), otherwise this
+ // class will balloon in size with each added event.
protected:
/**
diff --git a/src/crepe/api/Sprite.cpp b/src/crepe/api/Sprite.cpp
index ac0079e..bd2d5cf 100644
--- a/src/crepe/api/Sprite.cpp
+++ b/src/crepe/api/Sprite.cpp
@@ -10,8 +10,8 @@
using namespace std;
using namespace crepe;
-Sprite::Sprite(game_object_id_t id, const shared_ptr<Texture> image,
- const Color & color, const FlipSettings & flip)
+Sprite::Sprite(game_object_id_t id, const shared_ptr<Texture> image, const Color & color,
+ const FlipSettings & flip)
: Component(id),
color(color),
flip(flip),
diff --git a/src/crepe/api/Sprite.h b/src/crepe/api/Sprite.h
index 754184b..0192793 100644
--- a/src/crepe/api/Sprite.h
+++ b/src/crepe/api/Sprite.h
@@ -27,8 +27,8 @@ class AnimatorSystem;
/**
* \brief Represents a renderable sprite component.
*
- * A renderable sprite that can be displayed in the game. It includes a texture,
- * color, and flip settings, and is managed in layers with defined sorting orders.
+ * A renderable sprite that can be displayed in the game. It includes a texture, color, and
+ * flip settings, and is managed in layers with defined sorting orders.
*/
class Sprite : public Component {
@@ -42,8 +42,8 @@ public:
* \param color Color tint applied to the sprite.
* \param flip Flip settings for horizontal and vertical orientation.
*/
- Sprite(game_object_id_t id, const std::shared_ptr<Texture> image,
- const Color & color, const FlipSettings & flip);
+ Sprite(game_object_id_t id, const std::shared_ptr<Texture> image, const Color & color,
+ const FlipSettings & flip);
/**
* \brief Destroys the Sprite instance.
@@ -80,7 +80,8 @@ private:
//! Reads the all the variables plus the sprite_rect
friend class AnimatorSystem;
- //! Render area of the sprite this will also be adjusted by the AnimatorSystem if an Animator object is present in GameObject
+ //! Render area of the sprite this will also be adjusted by the AnimatorSystem if an Animator
+ // object is present in GameObject
Rect sprite_rect;
};
diff --git a/src/crepe/api/Texture.h b/src/crepe/api/Texture.h
index b89bc17..6965223 100644
--- a/src/crepe/api/Texture.h
+++ b/src/crepe/api/Texture.h
@@ -1,8 +1,7 @@
#pragma once
-// FIXME: this header can't be included because this is an API header, and SDL2
-// development headers won't be bundled with crepe. Why is this facade in the
-// API namespace?
+// FIXME: this header can't be included because this is an API header, and SDL2 development
+// headers won't be bundled with crepe. Why is this facade in the API namespace?
#include <SDL2/SDL_render.h>
#include <functional>
@@ -19,8 +18,8 @@ class Animator;
* \class Texture
* \brief Manages texture loading and properties.
*
- * The Texture class is responsible for loading an image from a source
- * and providing access to its dimensions. Textures can be used for rendering.
+ * The Texture class is responsible for loading an image from a source and providing access to
+ * its dimensions. Textures can be used for rendering.
*/
class Texture {
@@ -41,8 +40,7 @@ public:
* \brief Destroys the Texture instance, freeing associated resources.
*/
~Texture();
- // FIXME: this constructor shouldn't be necessary because this class doesn't
- // manage memory
+ // FIXME: this constructor shouldn't be necessary because this class doesn't manage memory
/**
* \brief Gets the width of the texture.
diff --git a/src/crepe/api/Transform.cpp b/src/crepe/api/Transform.cpp
index e9108c4..cd944bd 100644
--- a/src/crepe/api/Transform.cpp
+++ b/src/crepe/api/Transform.cpp
@@ -4,8 +4,7 @@
using namespace crepe;
-Transform::Transform(game_object_id_t id, const Vector2 & point,
- double rotation, double scale)
+Transform::Transform(game_object_id_t id, const Vector2 & point, double rotation, double scale)
: Component(id),
position(point),
rotation(rotation),
diff --git a/src/crepe/api/Transform.h b/src/crepe/api/Transform.h
index 7d6f785..18aa293 100644
--- a/src/crepe/api/Transform.h
+++ b/src/crepe/api/Transform.h
@@ -9,8 +9,8 @@ namespace crepe {
/**
* \brief Transform component
*
- * This class represents the Transform component. It stores the position,
- * rotation and scale of a GameObject.
+ * This class represents the Transform component. It stores the position, rotation and scale of
+ * a GameObject.
*/
class Transform : public Component {
public: