Starting new VN Structure

This commit is contained in:
2023-04-18 09:55:11 -07:00
parent 26efdfe314
commit 1c21c15261
77 changed files with 929 additions and 27 deletions

View File

@ -0,0 +1,53 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "VisualNovelTransformItemEvent.hpp"
using namespace Dawn;
VisualNovelTransformItemEvent::VisualNovelTransformItemEvent(
VisualNovelManager *man,
SceneItem *item,
glm::vec3 start,
glm::vec3 end,
easefunction_t *ease,
float_t duration
) : VisualNovelSimpleCallbackAnimationEvent<glm::vec3, Transform>(man) {
assertNotNull(item);
this->item = item;
this->callbackAnimation.setCallback(
&item->transform, &Transform::setLocalPosition
);
if(duration != 0) {
this->callbackAnimation.addKeyframe(0.0f, start);
}
this->callbackAnimation.addKeyframe(duration, end);
}
VisualNovelTransformItemEvent::VisualNovelTransformItemEvent(
VisualNovelManager *man,
SceneItem *item,
glm::vec3 end,
easefunction_t *ease,
float_t duration
) : VisualNovelSimpleCallbackAnimationEvent<glm::vec3, Transform>(man) {
assertNotNull(item);
this->item = item;
this->callbackAnimation.setCallback(
&item->transform, &Transform::setLocalPosition
);
if(duration != 0) this->relative = true;
this->callbackAnimation.addKeyframe(duration, end);
}
void VisualNovelTransformItemEvent::onStart(IVisualNovelEvent *previous) {
if(this->relative) {
this->callbackAnimation.addKeyframe(0.0f, this->item->transform.getLocalPosition());
}
VisualNovelSimpleCallbackAnimationEvent::onStart(previous);
}