Kaynağa Gözat

refractor folder

develop
Robin Thoni 8 yıl önce
ebeveyn
işleme
078d6c8018

+ 1
- 3
TheGame/openglrenderdevice.h Dosyayı Görüntüle

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

+ 1
- 1
TheGame/renderwidget.h Dosyayı Görüntüle

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

+ 10
- 10
UGameEngine/UGameEngine.pro Dosyayı Görüntüle

@@ -11,17 +11,17 @@ TEMPLATE = lib
11 11
 
12 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 26
 unix {
27 27
     target.path = /usr/lib

UGameEngine/abstractrenderdevice.cpp → UGameEngine/engine/abstractrenderdevice.cpp Dosyayı Görüntüle


UGameEngine/abstractrenderdevice.h → UGameEngine/engine/abstractrenderdevice.h Dosyayı Görüntüle

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

UGameEngine/ugameengine.cpp → UGameEngine/engine/ugameengine.cpp Dosyayı Görüntüle

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

UGameEngine/ugameengine.h → UGameEngine/engine/ugameengine.h Dosyayı Görüntüle

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

UGameEngine/ugeentity.cpp → UGameEngine/entities/ugeentity.cpp Dosyayı Görüntüle

@@ -1,7 +1,12 @@
1 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,3 +69,23 @@ void UGEEntity::scale(const Vector3D &scale)
64 69
 {
65 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 Dosyayı Görüntüle

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

UGameEngine/colorvector3d.cpp → UGameEngine/utils/colorvector3d.cpp Dosyayı Görüntüle

@@ -18,6 +18,10 @@ ColorVector3D::ColorVector3D(const ColorVector3D &other)
18 18
 {
19 19
 }
20 20
 
21
+ColorVector3D::~ColorVector3D()
22
+{
23
+}
24
+
21 25
 QColor ColorVector3D::getColor() const
22 26
 {
23 27
     return _color;

UGameEngine/colorvector3d.h → UGameEngine/utils/colorvector3d.h Dosyayı Görüntüle

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

UGameEngine/vector3d.cpp → UGameEngine/utils/vector3d.cpp Dosyayı Görüntüle


UGameEngine/vector3d.h → UGameEngine/utils/vector3d.h Dosyayı Görüntüle


+ 1
- 1
tests/testvector3d.cpp Dosyayı Görüntüle

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

Loading…
İptal
Kaydet