diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 12:19:56 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 12:19:56 +0100 |
commit | 87c74782e486647c46f9ca4d2f857094006e563c (patch) | |
tree | c8e0b893610cb90d7bd7578c3d076b7e905c822a /src/crepe/api | |
parent | ec3601fbc17a38a44608a04f53d4e36c1bff8c96 (diff) |
`make format`
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Animator.cpp | 3 | ||||
-rw-r--r-- | src/crepe/api/AssetManager.h | 3 | ||||
-rw-r--r-- | src/crepe/api/BehaviorScript.cpp | 5 | ||||
-rw-r--r-- | src/crepe/api/GameObject.cpp | 9 | ||||
-rw-r--r-- | src/crepe/api/GameObject.h | 6 | ||||
-rw-r--r-- | src/crepe/api/LoopManager.h | 5 | ||||
-rw-r--r-- | src/crepe/api/LoopManager.hpp | 10 | ||||
-rw-r--r-- | src/crepe/api/SceneManager.cpp | 10 | ||||
-rw-r--r-- | src/crepe/api/Script.cpp | 1 | ||||
-rw-r--r-- | src/crepe/api/Script.h | 1 | ||||
-rw-r--r-- | src/crepe/api/Transform.h | 2 | ||||
-rw-r--r-- | src/crepe/api/Vector2.cpp | 1 |
12 files changed, 30 insertions, 26 deletions
diff --git a/src/crepe/api/Animator.cpp b/src/crepe/api/Animator.cpp index cbf415d..fcc07ef 100644 --- a/src/crepe/api/Animator.cpp +++ b/src/crepe/api/Animator.cpp @@ -9,7 +9,8 @@ using namespace crepe; -Animator::Animator(game_object_id_t id, Sprite & ss, int row, int col, int col_animator) +Animator::Animator(game_object_id_t id, Sprite & ss, int row, int col, + int col_animator) : Component(id), spritesheet(ss), row(row), diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h index dbfaef3..86a9902 100644 --- a/src/crepe/api/AssetManager.h +++ b/src/crepe/api/AssetManager.h @@ -56,7 +56,8 @@ public: * 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/BehaviorScript.cpp b/src/crepe/api/BehaviorScript.cpp index 41c144c..c5fecef 100644 --- a/src/crepe/api/BehaviorScript.cpp +++ b/src/crepe/api/BehaviorScript.cpp @@ -3,5 +3,6 @@ using namespace crepe; -BehaviorScript::BehaviorScript(game_object_id_t id, ComponentManager & mgr) : Component(id), component_manager(mgr) {} - +BehaviorScript::BehaviorScript(game_object_id_t id, ComponentManager & mgr) + : Component(id), + component_manager(mgr) {} diff --git a/src/crepe/api/GameObject.cpp b/src/crepe/api/GameObject.cpp index dd20b7f..e05cea1 100644 --- a/src/crepe/api/GameObject.cpp +++ b/src/crepe/api/GameObject.cpp @@ -1,16 +1,18 @@ #include "api/Transform.h" +#include "BehaviorScript.h" #include "GameObject.h" #include "Metadata.h" -#include "BehaviorScript.h" using namespace crepe; using namespace std; -GameObject::GameObject(ComponentManager & component_manager, game_object_id_t id, const std::string & name, +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) { + : id(id), + component_manager(component_manager) { // Add Transform and Metadata components ComponentManager & mgr = this->component_manager; @@ -37,4 +39,3 @@ BehaviorScript & GameObject::add_component<BehaviorScript>() { ComponentManager & mgr = this->component_manager; return mgr.add_component<BehaviorScript>(this->id, mgr); } - diff --git a/src/crepe/api/GameObject.h b/src/crepe/api/GameObject.h index 7751fd0..e4a2539 100644 --- a/src/crepe/api/GameObject.h +++ b/src/crepe/api/GameObject.h @@ -2,8 +2,8 @@ #include <string> -#include "types.h" #include "Vector2.h" +#include "types.h" namespace crepe { @@ -31,7 +31,9 @@ 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; diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index ef1c14f..288dca2 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -2,8 +2,8 @@ #include <memory> -#include "../system/System.h" #include "../ComponentManager.h" +#include "../system/System.h" namespace crepe { @@ -74,7 +74,7 @@ protected: T & get_system(); private: - ComponentManager component_manager; + ComponentManager component_manager{}; std::unordered_map<std::type_index, std::unique_ptr<System>> systems; private: @@ -85,4 +85,3 @@ private: } // namespace crepe #include "LoopManager.hpp" - diff --git a/src/crepe/api/LoopManager.hpp b/src/crepe/api/LoopManager.hpp index 20e8d1c..8fb9aa3 100644 --- a/src/crepe/api/LoopManager.hpp +++ b/src/crepe/api/LoopManager.hpp @@ -3,8 +3,8 @@ #include <cassert> #include <memory> -#include "../system/System.h" #include "../Exception.h" +#include "../system/System.h" #include "LoopManager.h" @@ -13,8 +13,9 @@ namespace crepe { template <class T> T & LoopManager::get_system() { using namespace std; - static_assert(is_base_of<System, T>::value, "get_system must recieve a derivative class of System"); - + static_assert(is_base_of<System, T>::value, + "get_system must recieve a derivative class of System"); + const type_info & type = typeid(T); if (!this->systems.contains(type)) throw Exception("LoopManager: %s is not initialized", type.name()); @@ -29,7 +30,8 @@ T & LoopManager::get_system() { template <class T> void LoopManager::load_system() { using namespace std; - static_assert(is_base_of<System, T>::value, "load_system must recieve a derivative class of System"); + static_assert(is_base_of<System, T>::value, + "load_system must recieve a derivative class of System"); System * system = new T(this->component_manager); this->systems[typeid(T)] = unique_ptr<System>(system); diff --git a/src/crepe/api/SceneManager.cpp b/src/crepe/api/SceneManager.cpp index 814b7d7..4a38787 100644 --- a/src/crepe/api/SceneManager.cpp +++ b/src/crepe/api/SceneManager.cpp @@ -16,11 +16,11 @@ 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.cpp b/src/crepe/api/Script.cpp index 0423315..390cec7 100644 --- a/src/crepe/api/Script.cpp +++ b/src/crepe/api/Script.cpp @@ -1,4 +1,3 @@ #include "Script.h" using namespace crepe; - diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index c5e3cc4..837420f 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -49,4 +49,3 @@ private: } // namespace crepe #include "Script.hpp" - diff --git a/src/crepe/api/Transform.h b/src/crepe/api/Transform.h index a1ef406..902dafa 100644 --- a/src/crepe/api/Transform.h +++ b/src/crepe/api/Transform.h @@ -15,7 +15,7 @@ namespace crepe { class Transform : public Component { public: //! Translation (shift) - Vector2 position = { 0, 0 }; + Vector2 position = {0, 0}; //! Rotation, in degrees double rotation = 0; //! Multiplication factor diff --git a/src/crepe/api/Vector2.cpp b/src/crepe/api/Vector2.cpp index aa391fa..7da202a 100644 --- a/src/crepe/api/Vector2.cpp +++ b/src/crepe/api/Vector2.cpp @@ -41,4 +41,3 @@ bool Vector2::operator==(const Vector2 & other) const { bool Vector2::operator!=(const Vector2 & other) const { return !(*this == other); } - |