Dawn/src/dawn/prefab/UIPrefab.hpp
2023-01-06 21:01:06 -08:00

27 lines
610 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "Prefab.hpp"
#include "ui/UIComponent.hpp"
namespace Dawn {
template<class T, class P>
class UIPrefab :
public Prefab<T, UICanvas, P>
{
public:
static void apply(T *item) {
assertNotNull(item);
P::prefabApply(&item->getGame()->assetManager , item);
}
static T * prefabCreate(UICanvas *canvas) {
T * item = canvas->addElement<T>();
P::apply(item);
return item;
}
};
}