diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-11-07 12:36:08 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-11-07 12:36:08 +0100 |
commit | acbe6b5d4256db950827b120fe7cd781e45715f6 (patch) | |
tree | 8a4fa0077127a8d7f947da291d9a92efa94834ee | |
parent | 96ef24654d2ee26184ebcb5b9092649e67afe5d9 (diff) |
Made name and tag const
-rw-r--r-- | src/crepe/api/Metadata.cpp | 2 | ||||
-rw-r--r-- | src/crepe/api/Metadata.h | 4 | ||||
-rw-r--r-- | src/example/ecs.cpp | 4 | ||||
-rw-r--r-- | src/example/scene_manager.cpp | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/crepe/api/Metadata.cpp b/src/crepe/api/Metadata.cpp index 53d93da..55d9ae2 100644 --- a/src/crepe/api/Metadata.cpp +++ b/src/crepe/api/Metadata.cpp @@ -5,4 +5,4 @@ using namespace std; Metadata::Metadata(uint32_t game_object_id, const string & name, const string & tag) - : Component(game_object_id), name(name), tag(tag) {} + : Component(game_object_id), NAME(name), TAG(tag) {} diff --git a/src/crepe/api/Metadata.h b/src/crepe/api/Metadata.h index 4d37108..fdbed41 100644 --- a/src/crepe/api/Metadata.h +++ b/src/crepe/api/Metadata.h @@ -31,9 +31,9 @@ public: public: //! The name of the GameObject - std::string name; + const std::string NAME; //! The tag of the GameObject - std::string tag; + const std::string TAG; //! The id of the parent GameObject (-1 if no parent) uint32_t parent = -1; //! The ids of the children GameObjects diff --git a/src/example/ecs.cpp b/src/example/ecs.cpp index dfd3595..7593faf 100644 --- a/src/example/ecs.cpp +++ b/src/example/ecs.cpp @@ -38,8 +38,8 @@ int main() { // Print the Metadata and Transform components for (auto & m : metadata) { - cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().name - << " Tag: " << m.get().tag << " Parent: " << m.get().parent + cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().NAME + << " Tag: " << m.get().TAG << " Parent: " << m.get().parent << " Children: "; for (auto & c : m.get().children) { cout << c << " "; diff --git a/src/example/scene_manager.cpp b/src/example/scene_manager.cpp index 471c400..bfa9479 100644 --- a/src/example/scene_manager.cpp +++ b/src/example/scene_manager.cpp @@ -52,8 +52,8 @@ int main() { cout << "Metadata components of Scene1:" << endl; // Print the Metadata for (auto & m : metadata) { - cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().name - << " Tag: " << m.get().tag << endl; + cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().NAME + << " Tag: " << m.get().TAG << endl; } // Set scene2 as the next scene @@ -67,8 +67,8 @@ int main() { cout << "Metadata components of Scene2:" << endl; // Print the Metadata for (auto & m : metadata) { - cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().name - << " Tag: " << m.get().tag << endl; + cout << "Id: " << m.get().GAME_OBJECT_ID << " Name: " << m.get().NAME + << " Tag: " << m.get().TAG << endl; } return 0; |