-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameview.h
63 lines (52 loc) · 1.44 KB
/
gameview.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
55
56
57
58
59
60
61
62
63
#ifndef GAMEVIEW_H
#define GAMEVIEW_H
#include <QWidget>
#include <QLabel>
#include <QScrollArea>
class GamePiece;
class Grid;
class GameView : public QWidget
{
Q_OBJECT
private:
QScrollArea *area;
QLabel *back;
GamePiece *piece;
QPixmap *pixmap;
Grid *grid;
QVector<GamePiece*> * pieces;
bool gridShow;
bool gridSnap;
void drawGrid(int scale);
QPoint snapToGrid(QPoint p);
public:
explicit GameView(QWidget *parent = 0);
virtual void resizeEvent(QResizeEvent *ev);
void paintEvent(QPaintEvent *);
bool getGridShow();
bool getGridSnap();
void setGridShow(bool b);
void setGridSnap(bool b);
void saveBoard(QString filename);
void loadBoard(QString filename);
void sendPieceCreated(QString img, QPoint pos);
QPoint gridOffset();
int gridSize();
signals:
void pieceMoved(quint16,QPoint);
void pieceCreated(QString, QPoint);
void pieceCreatedPid(QString,QPoint,quint16);
void clearBoard();
void gridAdjusted(int,QPoint);
void pieceDeleted(quint16);
public slots:
void getPieceMoved(quint16 pid,QPoint p);
void getPieceDeleted(quint16 pid);
void addGamePiece(quint16 pid,QString imgName,QPoint pos);
void updatePiece(quint16 pid,QPoint p);
void adjustGrid(int size, int width, int height);
void clearPieces();
void adjustGrid(int size, QPoint offset);
void removePiece(quint16 pid);
};
#endif // GAMEVIEW_H