-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGameWidget.h
53 lines (40 loc) · 988 Bytes
/
GameWidget.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
#ifndef GAMEWIDGET_H
#define GAMEWIDGET_H
#include "common.h"
#include <QGLWidget>
#include <functional>
#include <QSet>
class GameMap;
class Game;
class Player;
class GameWidget : public QGLWidget
{
Q_OBJECT
public:
explicit GameWidget(QWidget *parent = 0);
void appendToGame(Game* g);
signals:
public slots:
void highlightWinner(Player *, QSet<QPoint> fields);
protected:
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent*);
void resizeEvent(QResizeEvent*);
void mousePressEvent(QMouseEvent*);
QPoint getCursorCell();
bool cursorOverAnyCell();
QRect cellRect(int x, int y, float sizeMod = 1.0);
private:
GameMap *map;
Game *game;
QPoint cursor;
QImage canvas;
QImage shadow;
float wSquare;
float hCenter;
float vCenter;
float lineWidth;
const float iconSize = 0.6f;
QSet<QPoint> highlightedFields;
};
#endif // GAMEWIDGET_H