diff options
author | chai <chaifix@163.com> | 2021-10-26 11:27:58 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-26 11:27:58 +0800 |
commit | 32345800737b668011a87328cd3dcce59ec2934c (patch) | |
tree | e1bbd47ae775f1268447f1c1011ab10492ee9197 /Runtime | |
parent | ef7aedf5f272c52247d8ee9522d7b2896d21af63 (diff) |
*misc
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/Common/DataBuffer.h | 16 | ||||
-rw-r--r-- | Runtime/FileSystem/File.h | 2 | ||||
-rw-r--r-- | Runtime/FileSystem/FileJobs.h | 5 | ||||
-rw-r--r-- | Runtime/FileSystem/Unzip.h | 7 | ||||
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindUtility.h | 4 | ||||
-rw-r--r-- | Runtime/Scripting/Common/Common.bind.cpp | 14 | ||||
-rw-r--r-- | Runtime/Scripting/Common/DataBuffer.bind.cpp | 19 | ||||
-rw-r--r-- | Runtime/Scripting/Path/Path.bind.cpp (renamed from Runtime/Scripting/Path.bind.cpp) | 0 |
8 files changed, 60 insertions, 7 deletions
diff --git a/Runtime/Common/DataBuffer.h b/Runtime/Common/DataBuffer.h index 330128f..591fe89 100644 --- a/Runtime/Common/DataBuffer.h +++ b/Runtime/Common/DataBuffer.h @@ -6,9 +6,21 @@ class DataBuffer : public LuaBind::NativeClass<DataBuffer> { public: - DataBuffer(LuaBind::VM* vm); - ~DataBuffer(); + DataBuffer(LuaBind::VM* vm) + :NativeClass<DataBuffer>(vm) + {}; + ~DataBuffer() + { + delete data; + } char* data; int length; + +private: + + LUA_BIND_DECL_CLASS(DataBuffer); + + LUA_BIND_DECL_METHOD(_GetLength); + };
\ No newline at end of file diff --git a/Runtime/FileSystem/File.h b/Runtime/FileSystem/File.h index b0d720c..e64a135 100644 --- a/Runtime/FileSystem/File.h +++ b/Runtime/FileSystem/File.h @@ -6,7 +6,5 @@ class File : public LuaBind::NativeClass<File> public: File(LuaBind::VM* vm); - char* data; - int length; };
\ No newline at end of file diff --git a/Runtime/FileSystem/FileJobs.h b/Runtime/FileSystem/FileJobs.h index 2e53a39..0970c54 100644 --- a/Runtime/FileSystem/FileJobs.h +++ b/Runtime/FileSystem/FileJobs.h @@ -8,7 +8,10 @@ class ReadFilesJob : public Job { public: - ReadFilesJob(LuaBind::VM* vm) : callback(vm), cur(0) {} + ReadFilesJob(LuaBind::VM* vm) + : callback(vm), cur(0) + { + } ~ReadFilesJob() {} void Dispacth(void* param) override; diff --git a/Runtime/FileSystem/Unzip.h b/Runtime/FileSystem/Unzip.h index 45dcbb0..ca38193 100644 --- a/Runtime/FileSystem/Unzip.h +++ b/Runtime/FileSystem/Unzip.h @@ -1,3 +1,10 @@ #pragma once +#include "Runtime/Threading/Job.h" +class UnzipFilesJob : public Job +{ +public: + + +}; diff --git a/Runtime/Lua/LuaBind/LuaBindUtility.h b/Runtime/Lua/LuaBind/LuaBindUtility.h index 7e6eb77..9cc4802 100644 --- a/Runtime/Lua/LuaBind/LuaBindUtility.h +++ b/Runtime/Lua/LuaBind/LuaBindUtility.h @@ -26,8 +26,8 @@ #define LUA_BIND_IMPL_METHOD(type, f) int type::f(lua_State* L) // 由应用程序实现的两个接口。上下文里有一个state。 -#define LUA_BIND_REGISTRY(type) void type::RegisterClass(::State& state) -#define LUA_BIND_POSTPROCESS(type) void type::RegisterPostprocess(::State& state) +#define LUA_BIND_REGISTRY(type) void type::RegisterClass(LuaBind::State& state) +#define LUA_BIND_POSTPROCESS(type) void type::RegisterPostprocess(LuaBind::State& state) // 用来注册的宏。之前这里忘了用可变宏,导致没有luaclastable ref没有注册对。 #define LUA_BIND_REGISTER_CLASS(state, param) state.RegisterNativeClass<param>() diff --git a/Runtime/Scripting/Common/Common.bind.cpp b/Runtime/Scripting/Common/Common.bind.cpp new file mode 100644 index 0000000..081426d --- /dev/null +++ b/Runtime/Scripting/Common/Common.bind.cpp @@ -0,0 +1,14 @@ +#include "Runtime/Lua/LuaHelper.h"
+#include "Runtime/Common/DataBuffer.h"
+
+int luaopen_GameLab(lua_State* L)
+{
+ LUA_BIND_STATE(L);
+
+ state.PushGlobalNamespace();
+ state.PushNamespace("GameLab");
+
+ state.RegisterNativeClass<DataBuffer>();
+
+ return 1;
+}
\ No newline at end of file diff --git a/Runtime/Scripting/Common/DataBuffer.bind.cpp b/Runtime/Scripting/Common/DataBuffer.bind.cpp new file mode 100644 index 0000000..5a5c30a --- /dev/null +++ b/Runtime/Scripting/Common/DataBuffer.bind.cpp @@ -0,0 +1,19 @@ +#include "Runtime/Common/DataBuffer.h"
+
+LUA_BIND_REGISTRY(DataBuffer) +{ + LUA_BIND_REGISTER_METHODS(state, + { "GetLength", _GetLength } + ); +} + +LUA_BIND_POSTPROCESS(DataBuffer) +{
+}
+
+LUA_BIND_IMPL_METHOD(DataBuffer, _GetLength)
+{
+ LUA_BIND_PREPARE(L, DataBuffer);
+ state.Push(self->length);
+ return 1;
+}
\ No newline at end of file diff --git a/Runtime/Scripting/Path.bind.cpp b/Runtime/Scripting/Path/Path.bind.cpp index 920f586..920f586 100644 --- a/Runtime/Scripting/Path.bind.cpp +++ b/Runtime/Scripting/Path/Path.bind.cpp |