Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
guiAnimatedImage.h
Go to the documentation of this file.
1#pragma once
2
4#include <algorithm>
5#include <string>
6
8
9class GUIAnimatedImage : public gui::IGUIElement {
10public:
11 GUIAnimatedImage(gui::IGUIEnvironment *env, gui::IGUIElement *parent,
12 s32 id, const core::rect<s32> &rectangle);
13
14 virtual void draw() override;
15
16 void setTexture(video::ITexture *texture) { m_texture = texture; };
17 video::ITexture *getTexture() const { return m_texture; };
18
19 void setMiddleRect(const core::rect<s32> &middle) { m_middle = middle; };
20 core::rect<s32> getMiddleRect() const { return m_middle; };
21
22 void setFrameDuration(u64 duration) { m_frame_duration = duration; };
23 u64 getFrameDuration() const { return m_frame_duration; };
24
25 void setFrameCount(s32 count) { m_frame_count = std::max(count, 1); };
26 s32 getFrameCount() const { return m_frame_count; };
27
28 void setFrameIndex(s32 frame) { m_frame_idx = std::max(frame, 0); };
29 s32 getFrameIndex() const { return m_frame_idx; };
30
31private:
32 video::ITexture *m_texture = nullptr;
33
35 s32 m_frame_idx = 0;
38 u64 m_frame_time = 0;
39
40 core::rect<s32> m_middle;
41};
Definition guiAnimatedImage.h:9
void setTexture(video::ITexture *texture)
Definition guiAnimatedImage.h:16
u64 getFrameDuration() const
Definition guiAnimatedImage.h:23
s32 getFrameCount() const
Definition guiAnimatedImage.h:26
u64 m_global_time
Definition guiAnimatedImage.h:34
s32 m_frame_idx
Definition guiAnimatedImage.h:35
core::rect< s32 > m_middle
Definition guiAnimatedImage.h:40
s32 getFrameIndex() const
Definition guiAnimatedImage.h:29
u64 m_frame_time
Definition guiAnimatedImage.h:38
u64 m_frame_duration
Definition guiAnimatedImage.h:37
core::rect< s32 > getMiddleRect() const
Definition guiAnimatedImage.h:20
s32 m_frame_count
Definition guiAnimatedImage.h:36
virtual void draw() override
Definition guiAnimatedImage.cpp:17
void setFrameCount(s32 count)
Definition guiAnimatedImage.h:25
GUIAnimatedImage(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Definition guiAnimatedImage.cpp:11
void setFrameIndex(s32 frame)
Definition guiAnimatedImage.h:28
void setFrameDuration(u64 duration)
Definition guiAnimatedImage.h:22
video::ITexture * getTexture() const
Definition guiAnimatedImage.h:17
video::ITexture * m_texture
Definition guiAnimatedImage.h:32
void setMiddleRect(const core::rect< s32 > &middle)
Definition guiAnimatedImage.h:19
Definition texturesource.h:25