-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgardenwidget.h
63 lines (51 loc) · 1.25 KB
/
gardenwidget.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
#ifndef GARDENWIDGET_H
#define GARDENWIDGET_H
#include "skybox.h"
#include "camera.h"
#include "terrain.h"
#include "tree.h"
#include "snow.h"
#include "snowdialog.h"
#include "naivetree.h"
#include "naivetreedialog.h"
#include <QGLWidget>
#include <QVector>
#include <QFile>
#include <QTimer>
class TreeDialog;
const float WIDTH = 8192;
const float HEIGHT = 8192;
const float LENGTH = 8192;
const int INTERVAL = 1000 / 120;
class GardenWidget : public QGLWidget
{
Q_OBJECT
public:
explicit GardenWidget(QWidget *parent = 0);
~GardenWidget();
signals:
public slots:
void saveForest();
void loadForest();
protected:
void initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
void keyPressEvent(QKeyEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
private:
SkyBox skybox;
Camera camera;
Terrain terrain;
QVector<Tree*> forest;
QVector<NaiveTree*> naiveforest;
Snow snow;
QTimer *timer;
TreeDialog *tree_dialog;
NaiveTreeDialog *naivetree_dialog;
SnowDialog *snow_dialog;
bool press_enable;
};
#endif // GARDENWIDGET_H