Tileset animations.
This commit is contained in:
27
src/dawn/display/animation/TiledSpriteAnimation.hpp
Normal file
27
src/dawn/display/animation/TiledSpriteAnimation.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "SimpleAnimation.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
struct TiledSpriteAnimation : public SimpleAnimation<int32_t> {
|
||||
public:
|
||||
int32_t frame = 0;
|
||||
TiledSprite *sprite = nullptr;
|
||||
|
||||
TiledSpriteAnimation(TiledSprite *sprite) :
|
||||
SimpleAnimation(&frame),
|
||||
sprite(sprite)
|
||||
{
|
||||
}
|
||||
|
||||
void tick(float_t delta) override {
|
||||
SimpleAnimation::tick(delta);
|
||||
this->sprite->setTile(frame);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user