-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsprite-piece-picker.h
54 lines (41 loc) · 1.04 KB
/
sprite-piece-picker.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
53
54
#ifndef SPRITE_PIECE_PICKER_H
#define SPRITE_PIECE_PICKER_H
#include <array>
#include <QColor>
#include <QGridLayout>
#include <QWidget>
#include "sprite-piece-button.h"
#include "tile-manager.h"
class SpritePiecePicker : public QWidget
{
Q_OBJECT
public:
SpritePiecePicker(TileManager &tile_manager);
void setPaletteLine(const int palette_line)
{
this->palette_line = palette_line;
updateSpritePieces();
}
int selected_tile() const
{
return tile_index;
}
public slots:
void setSelectedTile(const int tile_index)
{
this->tile_index = tile_index;
updateSpritePieces();
}
signals:
void pieceSelected(int width, int height);
private:
static constexpr int MAX_PIECE_WIDTH = 4;
static constexpr int MAX_PIECE_HEIGHT = 4;
void updateSpritePieces();
const TileManager &tile_manager;
QGridLayout grid_layout;
std::array<std::array<SpritePieceButton, MAX_PIECE_WIDTH>, MAX_PIECE_HEIGHT> buttons;
int tile_index = 0;
int palette_line = 0;
};
#endif // SPRITE_PIECE_PICKER_H