From 12f3ac102d3aea08af540dd7f2cf0e08e939a70d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Oct 2021 00:18:22 +0800 Subject: +loadimageasync test --- .../Libraries/GameLab/Engine/Resource/init.lua | 2 +- Data/Scripts/EditorApplication.lua | 7 +++---- ...51\227\256\351\242\230\350\256\260\345\275\225.xlsx" | Bin 0 -> 23318 bytes Runtime/Lua/LuaBind/LuaBindClass.hpp | 6 +++--- Runtime/Lua/LuaBind/LuaBindState.h | 2 +- Runtime/Lua/LuaBind/LuaBindUtility.h | 4 ++-- Runtime/Scripting/Resource/Resource.bind.cpp | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 "Documents/\351\227\256\351\242\230\350\256\260\345\275\225.xlsx" diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Resource/init.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Resource/init.lua index dd37dbb..a407869 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Resource/init.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Resource/init.lua @@ -9,7 +9,7 @@ m.ImageDataRequest = import("ImageDataRequest") -- methods m.LoadImageDataAsync = function(path) - local request = GameLab.Engine.ImageDataRequest.New() + local request = GameLab.Engine.Resource.ImageDataRequest.New() m.ReadImageDataAsync(path, function(imgData) request.isDone = true request.imageData = imgData diff --git a/Data/Scripts/EditorApplication.lua b/Data/Scripts/EditorApplication.lua index 852069d..6b42175 100644 --- a/Data/Scripts/EditorApplication.lua +++ b/Data/Scripts/EditorApplication.lua @@ -70,12 +70,11 @@ Debug.Log(tostring(imgData:GetHeight())) local tex = Rendering.Texture.New(imgData, false) -local requets = Rendering.LoadImageDataAsync("./Resources/Images/brickwall.jpg") +local requets = Resource.LoadImageDataAsync("./Resources/Images/brickwall.jpg") while true do - if requets.isDone then - Debug.Log("read image done!!!") - end + app:OnStep() app:PullMessage() + end diff --git "a/Documents/\351\227\256\351\242\230\350\256\260\345\275\225.xlsx" "b/Documents/\351\227\256\351\242\230\350\256\260\345\275\225.xlsx" new file mode 100644 index 0000000..f7099d6 Binary files /dev/null and "b/Documents/\351\227\256\351\242\230\350\256\260\345\275\225.xlsx" differ diff --git a/Runtime/Lua/LuaBind/LuaBindClass.hpp b/Runtime/Lua/LuaBind/LuaBindClass.hpp index 7fb4529..1da8513 100644 --- a/Runtime/Lua/LuaBind/LuaBindClass.hpp +++ b/Runtime/Lua/LuaBind/LuaBindClass.hpp @@ -154,7 +154,7 @@ namespace LuaBind { LUA_BIND_SETUP(L, "*"); - cc8* type = TYPE::GetClassName(); + cc8* type = TYPE::GetNativeClassName(); state.Push(type); return 1; } @@ -482,7 +482,7 @@ namespace LuaBind assert(self); #if LUA_BIND_PROFILER - std::cout << ": GC<" << TYPE::GetClassName() << ">\n"; + std::cout << ": GC<" << TYPE::GetNativeClassName() << ">\n"; #endif if (self->mWatchDog.mVMRef > 0) @@ -517,7 +517,7 @@ namespace LuaBind } else { - classname = TYPE::GetClassName(); + classname = TYPE::GetNativeClassName(); } lua_pushfstring(L, "%s: %p", classname, self); return 1; diff --git a/Runtime/Lua/LuaBind/LuaBindState.h b/Runtime/Lua/LuaBind/LuaBindState.h index 071287f..a47ed5d 100644 --- a/Runtime/Lua/LuaBind/LuaBindState.h +++ b/Runtime/Lua/LuaBind/LuaBindState.h @@ -387,7 +387,7 @@ namespace LuaBind Pop(1); // ref table } } - luaL_typerror(mState, idx, TYPE::GetClassName()); + luaL_typerror(mState, idx, TYPE::GetNativeClassName()); return nullptr; } diff --git a/Runtime/Lua/LuaBind/LuaBindUtility.h b/Runtime/Lua/LuaBind/LuaBindUtility.h index 9cc4802..c5807c1 100644 --- a/Runtime/Lua/LuaBind/LuaBindUtility.h +++ b/Runtime/Lua/LuaBind/LuaBindUtility.h @@ -10,8 +10,8 @@ friend class LuaBind::NativeClass; \ static void RegisterClass(LuaBind::State&); \ static void RegisterPostprocess(LuaBind::State&); \ - static const char* GetNativeClassName() { return #type; };\ - static const char* GetClassName() { return #type; }; + static const char* GetNativeClassName() { return #type; }; + //static const char* GetClassName() { return #type; }; // 作为基类的抽象工厂类可以使用此宏,注册一个入口,在派生类的注册函数中调用,注册基类的这些方法。 #define LUA_BIND_DECL_ABSTRACT_CLASS() \ diff --git a/Runtime/Scripting/Resource/Resource.bind.cpp b/Runtime/Scripting/Resource/Resource.bind.cpp index b4ba025..785115a 100644 --- a/Runtime/Scripting/Resource/Resource.bind.cpp +++ b/Runtime/Scripting/Resource/Resource.bind.cpp @@ -8,7 +8,7 @@ using namespace LuaBind; int ReadImageDataAsync(lua_State* L) { LUA_BIND_STATE(L); - LUA_BIND_CHECK(L, "TF"); + LUA_BIND_CHECK(L, "SF"); cc8* path = state.GetValue(1, ""); -- cgit v1.1-26-g67d0