-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainmenuitems.h
103 lines (86 loc) · 2.17 KB
/
mainmenuitems.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
#ifndef MAINMENUITEMS_H
#define MAINMENUITEMS_H
#include "abstractitem.h"
// File must include
#include <QPointF>
#include <QPixmap>
// Forward declaration
class QPixmap;
/**
* @brief An abstract class of items used in main menu.
*/
class AbstractMainMenuItem
{
public:
/**
* @brief Type of the items.
*/
enum ItemType{SwapClassicItem=0,
RotateClassicItem,
SwapEndlessItem,
RotateEndlessItem,
SwapTimingItem,
RotateTimingItem,
RotatePuzzleItem,
HelpItem,
ExitItem,
TwoPlayerGame,
UnvisibleBig,
};
/**
* @brief A function returns the pixmap of an item.
*/
static const QPixmap& pixmap(ItemType type, int frame);
};
/**
* @brief A class of items used in main menu which is buttons in a circle.
*/
class MainMenuGameItem : public AbstractCircleItem
{
public:
/**
* @brief Constructor with the type of the item.
*/
MainMenuGameItem(AbstractMainMenuItem::ItemType theType);
virtual void paint(QPainter *painter, int width, int height, int frame);
virtual double r();
private:
// The type of the item
AbstractMainMenuItem::ItemType type;
};
/**
* @brief A class of items used in main menu which is buttons in a rectangle.
*/
class MainMenuButtonItem : public AbstractRectItem
{
public:
/**
* @brief Constructor with the type of the item.
*/
MainMenuButtonItem(AbstractMainMenuItem::ItemType theType) :
type(theType) {}
virtual void paint(QPainter *painter, int width, int height, int frame);
virtual double width();
virtual double height();
private:
// The type of the item
AbstractMainMenuItem::ItemType type;
};
/**
* @brief A class of item used in main menu which is a rotating circle
*/
class RotatingCircleItem : public AbstractItem
{
public:
/**
* @brief Constructor with the type of the item.
*/
RotatingCircleItem(bool clockwise);
virtual void paint(QPainter *painter, int width, int height, int frame);
virtual bool in(QPointF mousePos, int width, int height)
{return false;}
private:
QPixmap p;
bool c;
};
#endif // MAINMENUITEMS_H