-
Notifications
You must be signed in to change notification settings - Fork 0
/
movepanel.h
52 lines (38 loc) · 1.17 KB
/
movepanel.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
49
50
51
52
#ifndef FATPUP_UI_MOVEPANEL_H
#define FATPUP_UI_MOVEPANEL_H
#include <map>
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include "fatpup/position.h"
class MovePanel
{
public:
explicit MovePanel(SDL_Renderer* renderer, int xOff, int width, int height);
~MovePanel();
void SetPosition(const fatpup::Position& pos);
void Move(fatpup::Move move);
void Render();
private:
void UpdateTextures();
void UpdateTexture(SDL_Surface* surface, SDL_Texture** texture, SDL_Rect* textureRect); // releases surface too
SDL_Renderer* _renderer = nullptr;
fatpup::Position _position;
fatpup::Position::State _positionState;
bool _positionUpdated = true;
SDL_Rect _backgroundRect;
TTF_Font* _font = nullptr;
enum
{
White = 0,
Black = 1
};
std::string _movesString[2];
SDL_Texture* _movesTexture[2] = { nullptr, nullptr };
SDL_Rect _movesTextureRect[2];
SDL_Texture* _turnIndicatorTexture[2] = { nullptr, nullptr };
SDL_Rect _turnIndicatorTextureRect[2];
SDL_Texture* _winDrawIndicatorTexture = nullptr;
SDL_Rect _winDrawIndicatorTextureRect;
};
#endif // #define FATPUP_UI_MOVEPANEL_H