-
Notifications
You must be signed in to change notification settings - Fork 1
/
workspace.h
115 lines (95 loc) · 3.28 KB
/
workspace.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
104
105
106
107
108
109
110
111
112
113
114
115
/**
* Atlas - Volumetric terrain editor
* Copyright (C) 2012-2015 Ondřej Záruba
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef WORKSPACE_H
#define WORKSPACE_H
#include <QObject>
#include <QScreen>
#include "canvas.h"
#include "project.h"
#include "editor/toolbox.h"
#include "./lib/render/scenerendererdeferred.h"
#include "./lib/render/scenerendererforward.h"
#include "gamepad/gamepad.h"
class Workspace : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(Canvas* canvas READ canvas WRITE setCanvas NOTIFY canvasChanged)
Q_PROPERTY(float speed READ speed WRITE setSpeed NOTIFY speedChanged)
Q_PROPERTY(float gamepadSize READ gamepadSize WRITE setGamepadSize NOTIFY gamepadSizeChanged)
Q_PROPERTY(bool play READ play WRITE setPlay NOTIFY playChanged)
public:
explicit Workspace(QQuickItem *parent = 0);
void unloadProject();
void setProject(Project * project);
void showWireframe(bool checked);
void showLight(bool checked);
void showShadow(bool checked);
void renderVr(bool enable);
bool eventFilter(QObject *obj, QEvent *event);
void wheelEvent(QWheelEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
void hoverMoveEvent(QHoverEvent *e);
void gamepadEvent(GamepadEvent * e);
void timerEvent(QTimerEvent *);
float gamepadSize() const;
bool play() const;
Canvas* canvas() const;
float speed() const;
signals:
void canvasChanged(Canvas* arg);
void speedChanged(float arg);
void selectScreenhotPath();
void gamepadSizeChanged(float arg);
void playChanged(bool arg);
public slots:
void undo();
void redo();
void selectTool(int index);
void makeSnapshot();
void goUp(bool move);
void goDown(bool move);
void setCanvas(Canvas* arg);
void setSpeed(float arg);
void addTool(ToolControl * tool);
void gamepadJoyStickLeft(QVector2D angle);
void gamepadJoyStickRight(QVector2D angle);
void screenShotDone(Image *img);
void saveScreenShot(const QUrl & path);
void canvasResized(int w, int h);
void setGamepadSize(float arg);
void passGamepadEvent(GamepadEvent * event);
void setPlay(bool arg);
private:
Driver driver;
Player player;
Project *project;
Toolbox editor;
Image * screen_shot;
Canvas* m_canvas;
float m_speed;
int timer_id;
QElapsedTimer time;
float m_gamepadSize;
Gamepad gamepad;
bool m_play;
};
#endif // WORKSPACE_H