-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationCycleWidget.h
More file actions
64 lines (48 loc) · 1.36 KB
/
AnimationCycleWidget.h
File metadata and controls
64 lines (48 loc) · 1.36 KB
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
///////////////////////////////////////////////////
//
// Hamish Carr
// October, 2023
//
// ------------------------
// AnimationCycleWidget.h
// ------------------------
//
// The main widget that shows the geometry
//
///////////////////////////////////////////////////
#ifndef _GEOMETRIC_WIDGET_H
#define _GEOMETRIC_WIDGET_H
#include <QtGlobal>
#include <QtOpenGLWidgets/QOpenGLWidget>
#include <QTimer>
#include <QMouseEvent>
#include <QCoreApplication>
#include "SceneModel.h"
class AnimationCycleWidget : public QOpenGLWidget
{ // class AnimationCycleWidget
Q_OBJECT
public:
bool keyActive = false;
// we have a single model encapsulating the scene
SceneModel *theScene;
// a timer for animation
QTimer *animationTimer;
// constructor
AnimationCycleWidget(QWidget *parent, SceneModel *TheScene);
// destructor
~AnimationCycleWidget();
protected:
// called when OpenGL context is set up
void initializeGL() override;
// called every time the widget is resized
void resizeGL(int w, int h) override;
// called every time the widget needs painting
void paintGL() override;
// called when a key is pressed
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent* event) override;
public slots:
// slot that gets called when it's time for the next frame
void nextFrame();
}; // class AnimationCycleWidget
#endif