27 lines
618 B
C++
27 lines
618 B
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "SimpleComponent.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
void SimpleComponent::onInit() {
|
|
this->initMethod(*this, events);
|
|
}
|
|
|
|
void SimpleComponent::onDispose() {
|
|
for(auto &event : events) {
|
|
event();
|
|
}
|
|
}
|
|
|
|
std::shared_ptr<SimpleComponent> Dawn::addSimpleComponent(
|
|
std::shared_ptr<SceneItem> item,
|
|
std::function<void(SceneComponent&, std::vector<std::function<void()>>&)> init
|
|
) {
|
|
auto cmp = item->addComponent<SimpleComponent>();
|
|
cmp->initMethod = init;
|
|
return cmp;
|
|
} |