From 6b1d1a1d64343f203014b89df02654e9a4b5a3f8 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 27 Oct 2016 11:29:02 +0200 Subject: [PATCH] Sdk/Lua: Bind TextureLibrary and TextureManager --- SDK/include/NDK/LuaAPI.inl | 17 +++++++++++++++++ SDK/include/NDK/LuaBinding.hpp | 2 ++ SDK/src/NDK/LuaBinding.cpp | 2 ++ SDK/src/NDK/LuaBinding_Graphics.cpp | 20 ++++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/SDK/include/NDK/LuaAPI.inl b/SDK/include/NDK/LuaAPI.inl index a47f67659..1ae2ddd43 100644 --- a/SDK/include/NDK/LuaAPI.inl +++ b/SDK/include/NDK/LuaAPI.inl @@ -756,6 +756,23 @@ namespace Nz return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting ImageParams + */ + + inline int LuaImplReplyVal(const LuaInstance& instance, ImageParams&& val, TypeTag) + { + instance.PushTable(0, 2); + instance.PushField("LevelCount", val.levelCount); + instance.PushField("LoadFormat", val.loadFormat); + + return 1; + } + /*! * \brief Replies by value for Lua * \return 1 in case of success diff --git a/SDK/include/NDK/LuaBinding.hpp b/SDK/include/NDK/LuaBinding.hpp index da6d282d1..0eb083162 100644 --- a/SDK/include/NDK/LuaBinding.hpp +++ b/SDK/include/NDK/LuaBinding.hpp @@ -80,6 +80,8 @@ namespace Ndk Nz::LuaClass model; Nz::LuaClass sprite; Nz::LuaClass spriteLibrary; + Nz::LuaClass textureLibrary; + Nz::LuaClass textureManager; // Renderer Nz::LuaClass texture; diff --git a/SDK/src/NDK/LuaBinding.cpp b/SDK/src/NDK/LuaBinding.cpp index 888e8fe4f..789427f26 100644 --- a/SDK/src/NDK/LuaBinding.cpp +++ b/SDK/src/NDK/LuaBinding.cpp @@ -60,6 +60,8 @@ namespace Ndk model("Model"), sprite("Sprite"), spriteLibrary("SpriteLibrary"), + textureLibrary("TextureLibrary"), + textureManager("TextureManager"), // Renderer texture("Texture"), diff --git a/SDK/src/NDK/LuaBinding_Graphics.cpp b/SDK/src/NDK/LuaBinding_Graphics.cpp index 597c0dc68..d6c0c532b 100644 --- a/SDK/src/NDK/LuaBinding_Graphics.cpp +++ b/SDK/src/NDK/LuaBinding_Graphics.cpp @@ -316,6 +316,24 @@ namespace Ndk spriteLibrary.BindStaticMethod("Register", &Nz::SpriteLibrary::Register); spriteLibrary.BindStaticMethod("Query", &Nz::SpriteLibrary::Query); spriteLibrary.BindStaticMethod("Unregister", &Nz::SpriteLibrary::Unregister); + + /*********************************** Nz::TextureLibrary ***********************************/ + + textureLibrary.BindStaticMethod("Get", &Nz::TextureLibrary::Get); + textureLibrary.BindStaticMethod("Has", &Nz::TextureLibrary::Has); + textureLibrary.BindStaticMethod("Register", &Nz::TextureLibrary::Register); + textureLibrary.BindStaticMethod("Query", &Nz::TextureLibrary::Query); + textureLibrary.BindStaticMethod("Unregister", &Nz::TextureLibrary::Unregister); + + /*********************************** Nz::TextureManager ***********************************/ + + textureManager.BindStaticMethod("Clear", &Nz::TextureManager::Clear); + textureManager.BindStaticMethod("Get", &Nz::TextureManager::Get); + textureManager.BindStaticMethod("GetDefaultParameters", &Nz::TextureManager::GetDefaultParameters); + textureManager.BindStaticMethod("Purge", &Nz::TextureManager::Purge); + textureManager.BindStaticMethod("Register", &Nz::TextureManager::Register); + textureManager.BindStaticMethod("SetDefaultParameters", &Nz::TextureManager::SetDefaultParameters); + textureManager.BindStaticMethod("Unregister", &Nz::TextureManager::Unregister); } /*! @@ -331,5 +349,7 @@ namespace Ndk model.Register(instance); sprite.Register(instance); spriteLibrary.Register(instance); + textureLibrary.Register(instance); + textureManager.Register(instance); } } \ No newline at end of file