Effects now use Constructor and Destructor to initialize or delete their data, instead of using start() and stop().
This commit is contained in:
@ -1,24 +1,21 @@
|
||||
#include "effect_animation.h"
|
||||
#include "functions.h"
|
||||
|
||||
AnimationEffect::AnimationEffect(AnimationData* anim, CRGB* bg, int x, int y) {
|
||||
this->animation_data = anim;
|
||||
AnimationEffect::AnimationEffect(const char* name, CRGB* bg, int x, int y) {
|
||||
this->bg_color = bg;
|
||||
this->xOffset = x;
|
||||
this->yOffset = y;
|
||||
}
|
||||
|
||||
void AnimationEffect::start() {
|
||||
this->animation = new Animation(this->animation_data);
|
||||
this->animation = new Animation(name, window);
|
||||
this->animation->setBgColor(this->bg_color);
|
||||
this->animation->setOffsets(this->xOffset, this->yOffset);
|
||||
}
|
||||
|
||||
void AnimationEffect::stop() {
|
||||
AnimationEffect::~AnimationEffect() {
|
||||
delete this->animation;
|
||||
}
|
||||
|
||||
void AnimationEffect::loop() {
|
||||
this->animation->drawFrame(this->window);
|
||||
this->animation->drawFrame();
|
||||
this->animation->advance();
|
||||
}
|
||||
|
Reference in New Issue
Block a user