palladium/include/pd/SpriteAnimation.hpp

43 lines
1.3 KiB
C++
Raw Normal View History

2024-07-12 19:48:34 +02:00
#pragma once
#include <citro2d.h>
#include <citro3d.h>
#include <pd/Sheet.hpp>
#include <pd/Sprite.hpp>
#include <pd/smart_ctor.hpp>
namespace Palladium {
/// @brief SpriteSheetAnimation Class
class SpriteSheetAnimation : public Palladium::Sprite {
public:
/// @brief Constructor
SpriteSheetAnimation() = default;
/// @brief Deconstructor
~SpriteSheetAnimation() = default;
PD_SMART_CTOR(SpriteSheetAnimation);
/// @brief Setup an Animation
/// @param sheet Input Spritesheet
/// @param imagecount Count of Images
/// @param startimage Where to Start the Loop
/// @param frame_begin Current Time (Should be 0)
/// @param frame_finish Time Length
void Setup(Palladium::Sheet::Ref sheet, size_t imagecount, size_t startimage,
float frame_begin, float frame_finish);
/// @brief Play the Animation
/// @param timespeed Speed of the animation
void Play(float timespeed);
private:
/// @param images Count of Images
size_t images;
/// @param imgs Another Count of images ???
size_t imgs = 0;
/// @param D_totaltime Current Time
float D_totaltime;
/// @param sheet The Sheet of Images
Palladium::Sheet::Ref sheet;
/// @param time Total Time from frame_finish
float time;
};
} // namespace Palladium