#include #include #include #include #include #include #include using namespace crepe; using namespace std; class ConcreteScene1 : public Scene { public: ConcreteScene1(string name) : Scene(name) {} void load_scene() { GameObject object1(0, "scene_1", "tag_scene_1", Point{0, 0}, 0, 1); GameObject object2(1, "scene_1", "tag_scene_1", Point{1, 0}, 0, 1); GameObject object3(2, "scene_1", "tag_scene_1", Point{2, 0}, 0, 1); } }; class ConcreteScene2 : public Scene { public: ConcreteScene2(string name) : Scene(name) {} void load_scene() { GameObject object1(0, "scene_2", "tag_scene_2", Point{0, 0}, 0, 1); GameObject object2(1, "scene_2", "tag_scene_2", Point{0, 1}, 0, 1); GameObject object3(2, "scene_2", "tag_scene_2", Point{0, 2}, 0, 1); GameObject object4(3, "scene_2", "tag_scene_2", Point{0, 3}, 0, 1); } }; int main() { SceneManager & scene_mgr = SceneManager::get_instance(); // Add the scenes to the scene manager scene_mgr.add_scene("scene1"); scene_mgr.add_scene("scene2"); // There is no need to call set_next_scene() at the beginnen, because the first scene will be automatically set as the next scene // Load scene1 (the first scene added) scene_mgr.load_next_scene(); // Get the Metadata components of each GameObject of Scene1 ComponentManager & component_mgr = ComponentManager::get_instance(); vector> metadata = component_mgr.get_components_by_type(); 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; } // Set scene2 as the next scene scene_mgr.set_next_scene("scene2"); // Load scene2 scene_mgr.load_next_scene(); // Get the Metadata components of each GameObject of Scene2 metadata = component_mgr.get_components_by_type(); 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; } return 0; }