// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "Prefab.hpp" #include "scene/SceneItem.hpp" namespace Dawn { template class SceneItemPrefab : public SceneItem, public Prefab { protected: public: static T * prefabCreate(Scene *scene, UICanvas *canvas) { T *item = scene->createSceneItemOfType(); item->prefabInit(); return item; } SceneItemPrefab(Scene *scene, sceneitemid_t id) : SceneItem(scene, id) { } /** * Virtual method called by the subclass for initialization after the * prefab has been created. */ virtual void prefabInit() = 0; }; }