Starting new VN Structure
This commit is contained in:
35
archive/visualnovel/events/VisualNovelFadeEvent.cpp
Normal file
35
archive/visualnovel/events/VisualNovelFadeEvent.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "VisualNovelFadeEvent.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
VisualNovelFadeEvent::VisualNovelFadeEvent(
|
||||
VisualNovelManager *man,
|
||||
struct Color color,
|
||||
bool_t fadeIn,
|
||||
easefunction_t *ease,
|
||||
float_t duration
|
||||
) : VisualNovelSimpleAnimationEvent(man, &duration) {
|
||||
this->color = color;
|
||||
this->fadeIn = fadeIn;
|
||||
this->duration = duration;
|
||||
this->simpleAnimation.easing = ease;
|
||||
}
|
||||
|
||||
void VisualNovelFadeEvent::onStart(IVisualNovelEvent *previous) {
|
||||
VisualNovelSimpleAnimationEvent::onStart(previous);
|
||||
|
||||
this->simpleAnimation = SimpleAnimation<float_t>(&this->manager->fader->color.a);
|
||||
this->manager->fader->color = this->color;
|
||||
this->manager->fader->color.a = this->fadeIn ? 0.0f : 1.0f;
|
||||
this->simpleAnimation.addKeyframe(
|
||||
0.0f, this->fadeIn ? 0.0f : 1.0f
|
||||
);
|
||||
this->simpleAnimation.addKeyframe(
|
||||
this->duration, this->fadeIn ? 1.0f : 0.0f
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user