-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimator.h
48 lines (36 loc) · 1.61 KB
/
animator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef ANIMATOR_H_INCLUDED
#define ANIMATOR_H_INCLUDED
#include <SFML/Graphics.hpp>
#include "animation.h"
namespace animation
{
class Animator
{
private:
sf::RenderWindow *m_window; // Игровое окно, к которому будет привязан UI инструмента
AnimationClip *m_clip; // Анимация, над которой ведётся работа
float m_speed; // Скорость анимации
sf::IntRect m_rect; // Размеры и координаты первого спрайта
int m_countOfSprites; // Кол-во спрайтов в анимации
bool m_animationIsSet; // Установлена ли анимация?
bool m_loop;
public:
// Конструктор аниматора
// window - игровое окно, к которому будет привязан UI инструмента
// clip - анимация, над которой ведётся работа
Animator(sf::RenderWindow* const window, AnimationClip *clip);
Animator(sf::RenderWindow* const window);
// ImGui работает с выделением памяти, поэтому нужен явный декструктор
~Animator();
// Обработчик событий
void ProcessEvent(const sf::Event &event);
// Рендер UI
void Render();
// Установка новой анимации
void SetAnimClip(AnimationClip *clip);
// Обновление аниматора
void Update(const sf::Time& deltaTime);
const bool IsSet() const { return m_animationIsSet; }
};
}
#endif // ANIMATOR_H_INCLUDED