-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglwidget.h
53 lines (41 loc) · 1.15 KB
/
glwidget.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 GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <QGLShaderProgram>
#include "rubixcube.h"
class GLWidget : public QGLWidget {
Q_OBJECT
private:
RubixCube rCube;
QMatrix4x4 pMatrix;
QGLShaderProgram shaderProgram;
int selectedCube = -1;
double alpha;
double beta;
double distance;
QPoint lastMousePosition;
bool pick = false;
const QColor solved = QColor(17, 51, 9);
const QColor unsolved = QColor(51, 9, 9);
public:
explicit GLWidget(QWidget* parent = 0);
~GLWidget();
QSize sizeHint() const;
public
slots:
void correctCube();
void incorrectCube();
protected:
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void keyPressEvent(QKeyEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
private:
void drawSingleCube(Cube& cube, QMatrix4x4 mMatrix, QMatrix4x4 vMatrix, QMatrix4x4 pMatrix);
void drawCube(QMatrix4x4 mMatrix, QMatrix4x4 vMatrix, QMatrix4x4 pMatrix);
};
#endif // GLWIDGET_H