Browse Source

refractor folder

develop
Robin Thoni 8 years ago
parent
commit
078d6c8018

+ 1
- 3
TheGame/openglrenderdevice.h View File

1
 #ifndef OPENGLRENDERDEVICE_H
1
 #ifndef OPENGLRENDERDEVICE_H
2
 #define OPENGLRENDERDEVICE_H
2
 #define OPENGLRENDERDEVICE_H
3
 
3
 
4
-#include "abstractrenderdevice.h"
4
+#include "engine/abstractrenderdevice.h"
5
 
5
 
6
 class OpenGLRenderDevice : public AbstractRenderDevice
6
 class OpenGLRenderDevice : public AbstractRenderDevice
7
 {
7
 {
9
 public:
9
 public:
10
     explicit OpenGLRenderDevice(QObject *parent = 0);
10
     explicit OpenGLRenderDevice(QObject *parent = 0);
11
 
11
 
12
-//    static float
13
-
14
 signals:
12
 signals:
15
 
13
 
16
 public slots:
14
 public slots:

+ 1
- 1
TheGame/renderwidget.h View File

4
 #include <QGLWidget>
4
 #include <QGLWidget>
5
 #include <QMouseEvent>
5
 #include <QMouseEvent>
6
 #include <QWheelEvent>
6
 #include <QWheelEvent>
7
-#include "ugameengine.h"
7
+#include "engine/ugameengine.h"
8
 #include "openglrenderdevice.h"
8
 #include "openglrenderdevice.h"
9
 
9
 
10
 class RenderWidget : public QGLWidget
10
 class RenderWidget : public QGLWidget

+ 10
- 10
UGameEngine/UGameEngine.pro View File

11
 
11
 
12
 DEFINES += UGAMEENGINE_LIBRARY
12
 DEFINES += UGAMEENGINE_LIBRARY
13
 
13
 
14
-SOURCES += ugameengine.cpp \
15
-    ugeentity.cpp \
16
-    vector3d.cpp \
17
-    abstractrenderdevice.cpp \
18
-    colorvector3d.cpp
14
+SOURCES += engine/ugameengine.cpp \
15
+    engine/abstractrenderdevice.cpp \
16
+    entities/ugeentity.cpp \
17
+    utils/vector3d.cpp \
18
+    utils/colorvector3d.cpp
19
 
19
 
20
-HEADERS += ugameengine.h\
21
-    ugeentity.h \
22
-    vector3d.h \
23
-    abstractrenderdevice.h \
24
-    colorvector3d.h
20
+HEADERS += engine/ugameengine.h\
21
+    engine/abstractrenderdevice.h \
22
+    entities/ugeentity.h \
23
+    utils/vector3d.h \
24
+    utils/colorvector3d.h
25
 
25
 
26
 unix {
26
 unix {
27
     target.path = /usr/lib
27
     target.path = /usr/lib

UGameEngine/abstractrenderdevice.cpp → UGameEngine/engine/abstractrenderdevice.cpp View File


UGameEngine/abstractrenderdevice.h → UGameEngine/engine/abstractrenderdevice.h View File

3
 
3
 
4
 #include <QObject>
4
 #include <QObject>
5
 #include <QColor>
5
 #include <QColor>
6
-#include "colorvector3d.h"
6
+#include "utils/colorvector3d.h"
7
 
7
 
8
 class AbstractRenderDevice : public QObject
8
 class AbstractRenderDevice : public QObject
9
 {
9
 {

UGameEngine/ugameengine.cpp → UGameEngine/engine/ugameengine.cpp View File

6
 {
6
 {
7
 }
7
 }
8
 
8
 
9
+UGameEngine::~UGameEngine()
10
+{
11
+}
12
+
9
 void UGameEngine::draw()
13
 void UGameEngine::draw()
10
 {
14
 {
11
     _device->preDraw();
15
     _device->preDraw();

UGameEngine/ugameengine.h → UGameEngine/engine/ugameengine.h View File

2
 #define UGAMEENGINE_H
2
 #define UGAMEENGINE_H
3
 
3
 
4
 #include "abstractrenderdevice.h"
4
 #include "abstractrenderdevice.h"
5
-#include "ugeentity.h"
5
+#include "entities/ugeentity.h"
6
 
6
 
7
 class UGameEngine : public QObject
7
 class UGameEngine : public QObject
8
 {
8
 {
9
     Q_OBJECT
9
     Q_OBJECT
10
 public:
10
 public:
11
     UGameEngine(AbstractRenderDevice* device);
11
     UGameEngine(AbstractRenderDevice* device);
12
+    virtual ~UGameEngine();
12
 
13
 
13
     void draw();
14
     void draw();
14
 
15
 

UGameEngine/ugeentity.cpp → UGameEngine/entities/ugeentity.cpp View File

1
 #include "ugeentity.h"
1
 #include "ugeentity.h"
2
 
2
 
3
-UGEEntity::UGEEntity(QObject *parent) :
4
-    QObject(parent)
3
+UGEEntity::UGEEntity(QObject *parent)
4
+    : QObject(parent)
5
+    , _visible(true)
6
+{
7
+}
8
+
9
+UGEEntity::~UGEEntity()
5
 {
10
 {
6
 }
11
 }
7
 
12
 
64
 {
69
 {
65
     _scale += scale;
70
     _scale += scale;
66
 }
71
 }
72
+bool UGEEntity::isVisible() const
73
+{
74
+    return _visible;
75
+}
76
+
77
+void UGEEntity::setVisible(bool visible)
78
+{
79
+    _visible = visible;
80
+}
81
+
82
+void UGEEntity::show()
83
+{
84
+    _visible = true;
85
+}
86
+
87
+void UGEEntity::hide()
88
+{
89
+    _visible = false;
90
+}
91
+

UGameEngine/ugeentity.h → UGameEngine/entities/ugeentity.h View File

4
 #include <QObject>
4
 #include <QObject>
5
 #include <QPoint>
5
 #include <QPoint>
6
 #include <QSharedPointer>
6
 #include <QSharedPointer>
7
-#include "vector3d.h"
8
-#include "abstractrenderdevice.h"
7
+#include "utils/vector3d.h"
8
+#include "engine/abstractrenderdevice.h"
9
 
9
 
10
 class UGEEntity : public QObject
10
 class UGEEntity : public QObject
11
 {
11
 {
12
     Q_OBJECT
12
     Q_OBJECT
13
 public:
13
 public:
14
     explicit UGEEntity(QObject *parent = 0);
14
     explicit UGEEntity(QObject *parent = 0);
15
+    virtual ~UGEEntity();
15
 
16
 
16
     Vector3D getPosition() const;
17
     Vector3D getPosition() const;
17
     void setPosition(const Vector3D& position);
18
     void setPosition(const Vector3D& position);
29
     void setScale(const Vector3D& scale);
30
     void setScale(const Vector3D& scale);
30
     void scale(const Vector3D& scale);
31
     void scale(const Vector3D& scale);
31
 
32
 
33
+    bool isVisible() const;
34
+    void setVisible(bool visible);
35
+    void show();
36
+    void hide();
37
+
32
     virtual void draw(AbstractRenderDevice* device) = 0;
38
     virtual void draw(AbstractRenderDevice* device) = 0;
33
 
39
 
34
 private:
40
 private:
40
 
46
 
41
     Vector3D _scale;
47
     Vector3D _scale;
42
 
48
 
49
+    bool _visible;
50
+
43
 };
51
 };
44
 
52
 
45
 #endif // UGEENTITY_H
53
 #endif // UGEENTITY_H

UGameEngine/colorvector3d.cpp → UGameEngine/utils/colorvector3d.cpp View File

18
 {
18
 {
19
 }
19
 }
20
 
20
 
21
+ColorVector3D::~ColorVector3D()
22
+{
23
+}
24
+
21
 QColor ColorVector3D::getColor() const
25
 QColor ColorVector3D::getColor() const
22
 {
26
 {
23
     return _color;
27
     return _color;

UGameEngine/colorvector3d.h → UGameEngine/utils/colorvector3d.h View File

10
     ColorVector3D(QColor color = Qt::black, double x = 0.0, double y = 0.0, double z = 0.0);
10
     ColorVector3D(QColor color = Qt::black, double x = 0.0, double y = 0.0, double z = 0.0);
11
     ColorVector3D(QColor color = Qt::black, const Vector3D& other = Vector3D());
11
     ColorVector3D(QColor color = Qt::black, const Vector3D& other = Vector3D());
12
     ColorVector3D(const ColorVector3D& other);
12
     ColorVector3D(const ColorVector3D& other);
13
+    virtual ~ColorVector3D();
13
 
14
 
14
     QColor getColor() const;
15
     QColor getColor() const;
15
     void setColor(const QColor &color);
16
     void setColor(const QColor &color);

UGameEngine/vector3d.cpp → UGameEngine/utils/vector3d.cpp View File


UGameEngine/vector3d.h → UGameEngine/utils/vector3d.h View File


+ 1
- 1
tests/testvector3d.cpp View File

1
 #include <QtTest/QtTest>
1
 #include <QtTest/QtTest>
2
-#include "vector3d.h"
2
+#include "utils/vector3d.h"
3
 
3
 
4
 class TestVector3D : public QObject
4
 class TestVector3D : public QObject
5
 {
5
 {

Loading…
Cancel
Save