-
Notifications
You must be signed in to change notification settings - Fork 1
/
basicpainter.h
138 lines (129 loc) · 4.3 KB
/
basicpainter.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef BASICPAINTER_H
#define BASICPAINTER_H
// File must include
#include <QVector>
#include <QPointF>
// Forward declaration
class Ball;
class AbstractGameBoardInfo;
class AbstractItem;
class QPainter;
/**
* @brief A class to do the basic paint.
*
* Currently, the functions are all static, because I haven't found anything to
* store in the painter.
*/
class BasicPainter
{
public:
/**
* @brief The id of the backgrounds.
*/
enum BackgroundId {MainMenu=0,
PuzzleMenu,
StageMenu,
Game37,
Game61,
PuzzleGame=Game61,
Help=5,
Achievement,
TwoPlayerGame,
MainMenu2};
/**
*@brief Paint the background.
*
*@param id The id of the background.
*@param painter The painter.
*@param width The width.
*@param height The height.
*@param frame The index of the frame to show.
*/
static void paintBackGround(BackgroundId id,
QPainter *painter,
int width,
int height,
int frame);
/**
*@brief Paint the basic balls.
*
*@param gameboard The gameboard.
*@param balls The balls.
*@param totalCount Count of the balls.
*@param painter The painter.
*@param xRate The scale in X direction.
*@param yRate The scale in Y direction.
*@param frame The index of the frame to show.
*/
static void paintBasicBalls(AbstractGameBoardInfo *gameboard,
Ball **balls,
int totalCount,
QPainter *painter,
double xRate,
double yRate,
int frame);
/**
*@brief Paint the basic balls in two player mode.
*
*@param balls The balls.
*@param totalCount Count of the balls.
*@param painter The painter.
*@param xRate The scale in X direction.
*@param yRate The scale in Y direction.
*@param frame The index of the frame to show.
*@param positionTranslater A function to translate the position of the ball.
*@param clockwise Whether it's clockwise.
*/
static void paintBasicBalls(Ball **balls,
int totalCount,
QPainter *painter,
double xRate,
double yRate,
int frame,
QPointF (*positionTranslater)(QPointF),
bool clockwise);
/**
*@brief Paint the small balls in the puzzle mode.
*
*@param gameboard The gameboard.
*@param colorIndex The index of the color of the balls.
*@param totalCount Count of the balls.
*@param painter The painter.
*@param xRate The scale in X direction.
*@param yRate The scale in Y direction.
*@param frame The index of the frame to show.
*@param size The size of the balls to show, should be 1 to 6.
*/
static void paintPuzzleGameBalls(AbstractGameBoardInfo *gameboard,
int *colorIndex,
int totalCount,
QPainter *painter,
double xRate,
double yRate,
int frame,
int size);
/**
*@brief Paint items.
*
*@param painter The painter.
*@param items The items.
*@param width The width of the whole QPaintDevice.
*@param height The height of the whole QPaintDevice.
*@param frame The index of the frame to show.
*/
static void paintItems(QPainter *painter,
QVector<AbstractItem *> items,
int width,
int height,
int frame);
/**
*@brief Darken the things which has been painted.
*
* In fact it only draws a rectangle to cover the original image.
*@param painter The painter.
*@param width The width of the whole QPaintDevice.
*@param height The height of the whole QPaintDevice.
*/
static void darken(QPainter *painter, int width, int height);
};
#endif // BASICPAINTER_H