summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine')
-rw-r--r--Source/Asura.Engine/Graphics/Image.h3
-rw-r--r--Source/Asura.Engine/Scripting/Portable.cpp9
-rw-r--r--Source/Asura.Engine/Scripting/Portable.h19
-rw-r--r--Source/Asura.Engine/graphics/image.h3
-rw-r--r--Source/Asura.Engine/graphics/render_state.h2
-rw-r--r--Source/Asura.Engine/scripting/portable.cpp9
-rw-r--r--Source/Asura.Engine/scripting/portable.h19
-rw-r--r--Source/Asura.Engine/scripting/portable.hpp43
-rw-r--r--Source/Asura.Engine/scripting/portable.inl30
9 files changed, 78 insertions, 59 deletions
diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h
index 2607969..916c365 100644
--- a/Source/Asura.Engine/Graphics/Image.h
+++ b/Source/Asura.Engine/Graphics/Image.h
@@ -2,13 +2,14 @@
#define __ASURA_ENGINE_IMAGE_H__
#include "math/vector2.hpp"
-#include "scripting/portable.h"
+#include "scripting/portable.hpp"
#include "fileSystem/reloadable.h"
#include "stringmap.hpp"
#include "manager.hpp"
#include "texture.h"
#include "color.h"
#include "image_data.h"
+#include "render_state.h"
namespace AsuraEngine
{
diff --git a/Source/Asura.Engine/Scripting/Portable.cpp b/Source/Asura.Engine/Scripting/Portable.cpp
deleted file mode 100644
index 0aa5f08..0000000
--- a/Source/Asura.Engine/Scripting/Portable.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "Portable.h"
-
-namespace AsuraEngine
-{
- namespace Scripting
- {
-
- }
-}
diff --git a/Source/Asura.Engine/Scripting/Portable.h b/Source/Asura.Engine/Scripting/Portable.h
deleted file mode 100644
index 0527308..0000000
--- a/Source/Asura.Engine/Scripting/Portable.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __ASURA_ENGINE_PORTABLE_H__
-#define __ASURA_ENGINE_PORTABLE_H__
-
-#include "Luax.hpp"
-#include "Config.h"
-#include "Type.h"
-
-namespace AsuraEngine
-{
- namespace Scripting
- {
-
- template<typename T>
- using Portable = Luax::LuaxClass<T>;
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/graphics/image.h b/Source/Asura.Engine/graphics/image.h
index 2607969..916c365 100644
--- a/Source/Asura.Engine/graphics/image.h
+++ b/Source/Asura.Engine/graphics/image.h
@@ -2,13 +2,14 @@
#define __ASURA_ENGINE_IMAGE_H__
#include "math/vector2.hpp"
-#include "scripting/portable.h"
+#include "scripting/portable.hpp"
#include "fileSystem/reloadable.h"
#include "stringmap.hpp"
#include "manager.hpp"
#include "texture.h"
#include "color.h"
#include "image_data.h"
+#include "render_state.h"
namespace AsuraEngine
{
diff --git a/Source/Asura.Engine/graphics/render_state.h b/Source/Asura.Engine/graphics/render_state.h
index f313296..a80efd3 100644
--- a/Source/Asura.Engine/graphics/render_state.h
+++ b/Source/Asura.Engine/graphics/render_state.h
@@ -6,7 +6,7 @@
#include "Math/Transform.h"
#include "Shader.h"
-#include "BlendMode.h"
+#include "blend_mode.h"
namespace AsuraEngine
{
diff --git a/Source/Asura.Engine/scripting/portable.cpp b/Source/Asura.Engine/scripting/portable.cpp
deleted file mode 100644
index 0aa5f08..0000000
--- a/Source/Asura.Engine/scripting/portable.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "Portable.h"
-
-namespace AsuraEngine
-{
- namespace Scripting
- {
-
- }
-}
diff --git a/Source/Asura.Engine/scripting/portable.h b/Source/Asura.Engine/scripting/portable.h
deleted file mode 100644
index 0527308..0000000
--- a/Source/Asura.Engine/scripting/portable.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __ASURA_ENGINE_PORTABLE_H__
-#define __ASURA_ENGINE_PORTABLE_H__
-
-#include "Luax.hpp"
-#include "Config.h"
-#include "Type.h"
-
-namespace AsuraEngine
-{
- namespace Scripting
- {
-
- template<typename T>
- using Portable = Luax::LuaxClass<T>;
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/scripting/portable.hpp b/Source/Asura.Engine/scripting/portable.hpp
new file mode 100644
index 0000000..773e7ad
--- /dev/null
+++ b/Source/Asura.Engine/scripting/portable.hpp
@@ -0,0 +1,43 @@
+#ifndef __ASURA_ENGINE_PORTABLE_H__
+#define __ASURA_ENGINE_PORTABLE_H__
+
+#include "Config.h"
+#include "Luax.hpp"
+#include "Type.h"
+
+namespace AsuraEngine
+{
+ namespace Scripting
+ {
+
+ template<typename T>
+ class Portable : public Luax::LuaxClass<T>
+ {
+ public:
+
+ Portable();
+ virtual ~Portable();
+
+ void Retain();
+ void Release();
+
+ private:
+
+ ///
+ /// ̱߳luagc߳˴native objectdelete
+ ///
+ int mRefCount;
+
+ ///
+ /// deleteգ̳portable࣬޷ʹdeleteֻʹRelease
+ ///
+ bool mSafer;
+
+ };
+
+#include "portable.inl"
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/scripting/portable.inl b/Source/Asura.Engine/scripting/portable.inl
new file mode 100644
index 0000000..a27b2e8
--- /dev/null
+++ b/Source/Asura.Engine/scripting/portable.inl
@@ -0,0 +1,30 @@
+
+template<typename T>
+Portable<T>::Portable()
+ : mRefCount(1)
+ , mSafer(false)
+{
+}
+
+template<typename T>
+Portable<T>::~Portable()
+{
+ ASSERT(mSafer);
+}
+
+template<typename T>
+void Portable<T>::Retain()
+{
+ ++mRefCount;
+}
+
+template<typename T>
+void Portable<T>::Release()
+{
+ if (--mRefCount <= 0)
+ {
+ mSafer = true;
+ delete this;
+ }
+}
+