AnimatedSprite.h
AnimatedSprite.h
CPP1/* Copyright Statement:2 *3 * (C) 2021-2025 Cubios Inc. All rights reserved.4 */5#pragma once6#include "SceneObject.h"7#include <string>8#include <vector>910#include "SpriteAtlas.h"1112namespace Cubios13{14namespace Gfx15{16class AnimatedSprite: public Cubios::SceneObject17{18 public:1920 enum playbackMode_t21 {22 Loop = 0,23 Bounce,24 Set25 };2627 AnimatedSprite(std::vector<std::string>& names, const Cubios::Math::Transform& t);28 AnimatedSprite(std::vector<std::string>& names, float x, float y);29 AnimatedSprite(std::vector<std::string>& names);3031 AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, const Cubios::Math::Transform& t);32 AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame, float x, float y);33 AnimatedSprite(std::string name,std::string extension, int16_t firstFrame, int16_t lastFrame);3435 AnimatedSprite(const AnimatedSprite& sprite);3637 AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, const Cubios::Math::Transform& t);38 AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas, float x, float y);39 AnimatedSprite(Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas);4041 virtual ~AnimatedSprite();42 void Render() override;4344 int16_t Tick(uint32_t dt);4546 Cubios::SceneObject* SetFrame(int16_t frameNumber);47 Cubios::SceneObject* SetPlaybackSpeed(int16_t speed);48 Cubios::SceneObject* SetPlaybackMode(playbackMode_t mode);4950 int16_t PrevFrame();51 int16_t NextFrame();5253 protected:5455 virtual void doLoop(uint32_t dt);56 virtual void doBounce(uint32_t dt);57 virtual void doSet(uint32_t dt) {}5859 int16_t playbackSpeed;60 int16_t numFrames;61 int16_t startFrame;62 int32_t prevTime;63 uint32_t lastDt;6465 std::vector<u32_t> resourceIds;6667 playbackMode_t playbackMode;68 bool reverse;6970 int16_t currentFrame;7172 Cubios::Gfx::SpriteAtlas<Cubios::Gfx::SpriteAtlasElement>* atlas;73};74}75}76
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.