2020-02-15 16:33:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "irrlichttypes_extrabloated.h"
|
2022-07-03 14:52:26 +02:00
|
|
|
#include <algorithm>
|
2020-03-16 22:56:48 +01:00
|
|
|
#include <string>
|
2020-02-15 16:33:18 +01:00
|
|
|
|
|
|
|
class ISimpleTextureSource;
|
|
|
|
|
|
|
|
class GUIAnimatedImage : public gui::IGUIElement {
|
|
|
|
public:
|
2020-03-16 22:56:48 +01:00
|
|
|
GUIAnimatedImage(gui::IGUIEnvironment *env, gui::IGUIElement *parent,
|
2022-07-03 14:52:26 +02:00
|
|
|
s32 id, const core::rect<s32> &rectangle);
|
2020-02-15 16:33:18 +01:00
|
|
|
|
|
|
|
virtual void draw() override;
|
|
|
|
|
2022-07-03 14:52:26 +02:00
|
|
|
void setTexture(video::ITexture *texture) { m_texture = texture; };
|
|
|
|
video::ITexture *getTexture() const { return m_texture; };
|
|
|
|
|
|
|
|
void setMiddleRect(const core::rect<s32> &middle) { m_middle = middle; };
|
|
|
|
core::rect<s32> getMiddleRect() const { return m_middle; };
|
|
|
|
|
|
|
|
void setFrameDuration(u64 duration) { m_frame_duration = duration; };
|
|
|
|
u64 getFrameDuration() const { return m_frame_duration; };
|
|
|
|
|
|
|
|
void setFrameCount(s32 count) { m_frame_count = std::max(count, 1); };
|
|
|
|
s32 getFrameCount() const { return m_frame_count; };
|
|
|
|
|
|
|
|
void setFrameIndex(s32 frame) { m_frame_idx = std::max(frame, 0); };
|
2020-03-16 22:56:48 +01:00
|
|
|
s32 getFrameIndex() const { return m_frame_idx; };
|
|
|
|
|
2020-02-15 16:33:18 +01:00
|
|
|
private:
|
2020-03-16 22:56:48 +01:00
|
|
|
video::ITexture *m_texture = nullptr;
|
2022-07-03 14:52:26 +02:00
|
|
|
|
2020-03-16 22:56:48 +01:00
|
|
|
u64 m_global_time = 0;
|
|
|
|
s32 m_frame_idx = 0;
|
|
|
|
s32 m_frame_count = 1;
|
2022-07-03 14:52:26 +02:00
|
|
|
u64 m_frame_duration = 0;
|
2020-03-16 22:56:48 +01:00
|
|
|
u64 m_frame_time = 0;
|
2022-07-03 14:52:26 +02:00
|
|
|
|
|
|
|
core::rect<s32> m_middle;
|
2020-02-15 16:33:18 +01:00
|
|
|
};
|