// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "Prefab.hpp" #include "game/DawnGame.hpp" namespace Dawn { template class SceneItemPrefab : public SceneItem, public Prefab { public: /** * Creates an instance of this prefab for the given scene. * * @param scene Scene that this prefab is going to be added to. * @return The created prefab instance. */ static O * prefabCreate(Scene *scene) { O *item = scene->createSceneItemOfType(); item->prefabInit(&scene->game->assetManager); return item; } /** * Constructor for this SceneItemPrefab. * * @param scene Scene that this prefab belongs to. * @param id ID of this scene 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(AssetManager *man) = 0; }; }