-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrubixcube.h
61 lines (55 loc) · 1.27 KB
/
rubixcube.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
#ifndef RUBIXCUBE_H
#define RUBIXCUBE_H
#include "cube.h"
#include "side.h"
#include <QObject>
/**
* @brief RubixCube::RubixCube
*
* 5
* |
* _____V___
* / /|
* / 2 / |
* /________/3 |
* 0-> | | /
* | 1 | /
* |_______|/
* /\
* |
* 4
*/
class RubixCube : public QObject {
Q_OBJECT
private:
QVector<Cube*> cubes;
QVector<Side*> sides;
QVector<int> initialSideIds;
const int rotationSpeed = 10;
const int sleepTime = 10;
public:
enum SIDENAMES {
TOP = 2,
BACK = 5,
FRONT = 1,
LEFT = 0,
DOWN = 4,
RIGHT = 3
};
RubixCube();
void rotateX(int block, int degree, bool rotPositiv);
void rotateY(int block, int degree, bool rotPositiv);
void rotateZ(int block, int degree, bool rotPositiv);
QVector<Cube*> getCubes() const;
QVector<Side*> getSides() const;
signals:
void updateGL();
void correctCube();
void incorrectCube();
private:
bool equalSides(QVector<Side*> _sides) const;
QVector<Side*> getSides(Cube* cube);
void rotateSide(RubixCube::SIDENAMES side);
void rotateSingleSide(RubixCube::SIDENAMES sidename);
};
#endif // RUBIXCUBE_H