diff options
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/crepe/Component.h | 3 | ||||
-rw-r--r-- | src/crepe/GameObject.cpp | 7 | ||||
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 3 | ||||
-rw-r--r-- | src/crepe/api/AudioSource.h | 4 | ||||
-rw-r--r-- | src/crepe/api/BehaviorScript.cpp | 1 | ||||
-rw-r--r-- | src/crepe/api/BehaviorScript.h | 2 | ||||
-rw-r--r-- | src/crepe/api/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/crepe/api/Collider.cpp (renamed from src/crepe/Collider.cpp) | 2 | ||||
-rw-r--r-- | src/crepe/api/Collider.h (renamed from src/crepe/Collider.h) | 6 | ||||
-rw-r--r-- | src/crepe/api/GameObject.cpp | 7 | ||||
-rw-r--r-- | src/crepe/api/GameObject.h (renamed from src/crepe/GameObject.h) | 4 | ||||
-rw-r--r-- | src/crepe/api/GameObject.hpp (renamed from src/crepe/GameObject.hpp) | 8 | ||||
-rw-r--r-- | src/crepe/api/Rigidbody.cpp (renamed from src/crepe/Rigidbody.cpp) | 2 | ||||
-rw-r--r-- | src/crepe/api/Rigidbody.h (renamed from src/crepe/Rigidbody.h) | 6 | ||||
-rw-r--r-- | src/crepe/api/Sprite.cpp (renamed from src/crepe/Sprite.cpp) | 2 | ||||
-rw-r--r-- | src/crepe/api/Sprite.h (renamed from src/crepe/Sprite.h) | 6 |
17 files changed, 40 insertions, 41 deletions
diff --git a/src/crepe/CMakeLists.txt b/src/crepe/CMakeLists.txt index 8323490..cfa51fb 100644 --- a/src/crepe/CMakeLists.txt +++ b/src/crepe/CMakeLists.txt @@ -4,10 +4,6 @@ target_sources(crepe PUBLIC SoundContext.cpp ComponentManager.cpp Component.cpp - GameObject.cpp - Collider.cpp - Rigidbody.cpp - Sprite.cpp ScriptSystem.cpp ) @@ -18,11 +14,6 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES ComponentManager.h ComponentManager.hpp Component.h - GameObject.h - GameObject.hpp - Collider.h - Rigidbody.h - Sprite.h System.h ScriptSystem.h ) diff --git a/src/crepe/Component.h b/src/crepe/Component.h index d9a01ac..9cda177 100644 --- a/src/crepe/Component.h +++ b/src/crepe/Component.h @@ -8,9 +8,8 @@ protected: public: virtual ~Component() = default; - // TODO: shouldn't this constructor be deleted because this class will never - // directly be instantiated? +public: bool active = true; }; diff --git a/src/crepe/GameObject.cpp b/src/crepe/GameObject.cpp deleted file mode 100644 index de3beb6..0000000 --- a/src/crepe/GameObject.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "GameObject.h" - -using namespace crepe; - -GameObject::GameObject(uint32_t id, std::string name, std::string tag, - int layer) - : id(id), name(name), tag(tag), active(true), layer(layer) {} diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp index b512d27..bb067dc 100644 --- a/src/crepe/api/AudioSource.cpp +++ b/src/crepe/api/AudioSource.cpp @@ -1,7 +1,8 @@ +#include <memory> + #include "AudioSource.h" #include "../Sound.h" -#include <memory> using namespace crepe::api; diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h index 2d26cda..7980212 100644 --- a/src/crepe/api/AudioSource.h +++ b/src/crepe/api/AudioSource.h @@ -2,8 +2,8 @@ #include <memory> -#include "Asset.h" -#include "Component.h" +#include "../Asset.h" +#include "../Component.h" namespace crepe { class Sound; diff --git a/src/crepe/api/BehaviorScript.cpp b/src/crepe/api/BehaviorScript.cpp index 1f236b4..84bfd4c 100644 --- a/src/crepe/api/BehaviorScript.cpp +++ b/src/crepe/api/BehaviorScript.cpp @@ -1,7 +1,6 @@ #include "../util/log.h" #include "BehaviorScript.h" -#include "Script.h" using namespace crepe::api; diff --git a/src/crepe/api/BehaviorScript.h b/src/crepe/api/BehaviorScript.h index 6ce6798..25d3cc5 100644 --- a/src/crepe/api/BehaviorScript.h +++ b/src/crepe/api/BehaviorScript.h @@ -2,7 +2,7 @@ #include <memory> -#include "Component.h" +#include "../Component.h" #include "Script.h" namespace crepe { diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index 6b337be..ae92f3d 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -2,11 +2,20 @@ target_sources(crepe PUBLIC # AudioSource.cpp BehaviorScript.cpp Script.cpp + GameObject.cpp + Collider.cpp + Rigidbody.cpp + Sprite.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES # AudioSource.h BehaviorScript.h Script.h + GameObject.h + GameObject.hpp + Collider.h + Rigidbody.h + Sprite.h ) diff --git a/src/crepe/Collider.cpp b/src/crepe/api/Collider.cpp index 3f12afd..6370a42 100644 --- a/src/crepe/Collider.cpp +++ b/src/crepe/api/Collider.cpp @@ -1,5 +1,5 @@ #include "Collider.h" -using namespace crepe; +using namespace crepe::api; Collider::Collider(int size) : size(size) {} diff --git a/src/crepe/Collider.h b/src/crepe/api/Collider.h index 120da05..72d8e77 100644 --- a/src/crepe/Collider.h +++ b/src/crepe/api/Collider.h @@ -1,8 +1,8 @@ #pragma once -#include "Component.h" +#include "../Component.h" -namespace crepe { +namespace crepe::api { class Collider : public Component { public: @@ -11,4 +11,4 @@ public: int size; }; -} // namespace crepe +} // namespace crepe::api diff --git a/src/crepe/api/GameObject.cpp b/src/crepe/api/GameObject.cpp new file mode 100644 index 0000000..b167187 --- /dev/null +++ b/src/crepe/api/GameObject.cpp @@ -0,0 +1,7 @@ +#include "GameObject.h" + +using namespace crepe::api; +using namespace std; + +GameObject::GameObject(uint32_t id, string name, string tag, int layer) + : id(id), name(name), tag(tag), active(true), layer(layer) {} diff --git a/src/crepe/GameObject.h b/src/crepe/api/GameObject.h index b5d6399..57508c5 100644 --- a/src/crepe/GameObject.h +++ b/src/crepe/api/GameObject.h @@ -3,7 +3,7 @@ #include <cstdint> #include <string> -namespace crepe { +namespace crepe::api { class GameObject { public: @@ -19,6 +19,6 @@ public: int layer; }; -} // namespace crepe +} // namespace crepe::api #include "GameObject.hpp" diff --git a/src/crepe/GameObject.hpp b/src/crepe/api/GameObject.hpp index 8cd1abe..8295ea3 100644 --- a/src/crepe/GameObject.hpp +++ b/src/crepe/api/GameObject.hpp @@ -1,10 +1,10 @@ #pragma once -#include "GameObject.h" +#include "../ComponentManager.h" -#include "ComponentManager.h" +#include "GameObject.h" -namespace crepe { +namespace crepe::api { template <typename T, typename... Args> T & GameObject::add_component(Args &&... args) { @@ -12,4 +12,4 @@ T & GameObject::add_component(Args &&... args) { return mgr.add_component<T>(id, std::forward<Args>(args)...); } -} // namespace crepe +} // namespace crepe::api diff --git a/src/crepe/Rigidbody.cpp b/src/crepe/api/Rigidbody.cpp index 495d908..98d1d60 100644 --- a/src/crepe/Rigidbody.cpp +++ b/src/crepe/api/Rigidbody.cpp @@ -1,6 +1,6 @@ #include "Rigidbody.h" -using namespace crepe; +using namespace crepe::api; Rigidbody::Rigidbody(int mass, int gravityScale, int bodyType) : mass(mass), gravity_scale(gravityScale), body_type(bodyType) {} diff --git a/src/crepe/Rigidbody.h b/src/crepe/api/Rigidbody.h index 63a8877..6cae579 100644 --- a/src/crepe/Rigidbody.h +++ b/src/crepe/api/Rigidbody.h @@ -1,8 +1,8 @@ #pragma once -#include "Component.h" +#include "../Component.h" -namespace crepe { +namespace crepe::api { class Rigidbody : public Component { public: @@ -13,4 +13,4 @@ public: int body_type; }; -} // namespace crepe +} // namespace crepe::api diff --git a/src/crepe/Sprite.cpp b/src/crepe/api/Sprite.cpp index a5a5e68..aa7dbb0 100644 --- a/src/crepe/Sprite.cpp +++ b/src/crepe/api/Sprite.cpp @@ -2,7 +2,7 @@ #include "Sprite.h" -using namespace crepe; +using namespace crepe::api; using namespace std; Sprite::Sprite(string path) : path(path) {} diff --git a/src/crepe/Sprite.h b/src/crepe/api/Sprite.h index 143e702..580f825 100644 --- a/src/crepe/Sprite.h +++ b/src/crepe/api/Sprite.h @@ -2,9 +2,9 @@ #include <string> -#include "Component.h" +#include "../Component.h" -namespace crepe { +namespace crepe::api { class Sprite : public Component { public: @@ -13,4 +13,4 @@ public: std::string path; }; -} // namespace crepe +} // namespace crepe::api |