From 3bf95af10c05c5f2d49c42d814aa9766d7fd7c1b Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 3 Feb 2026 16:24:09 -0600 Subject: [PATCH] feat(ui): implement CSimpleTexture_SetDrawLayer --- src/ui/simple/CSimpleTextureScript.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ui/simple/CSimpleTextureScript.cpp b/src/ui/simple/CSimpleTextureScript.cpp index 2dbe992..ada51de 100644 --- a/src/ui/simple/CSimpleTextureScript.cpp +++ b/src/ui/simple/CSimpleTextureScript.cpp @@ -19,7 +19,25 @@ int32_t CSimpleTexture_GetDrawLayer(lua_State* L) { } int32_t CSimpleTexture_SetDrawLayer(lua_State* L) { - WHOA_UNIMPLEMENTED(0); + auto type = CSimpleTexture::GetObjectType(); + auto texture = static_cast(FrameScript_GetObjectThis(L, type)); + + if (!lua_isstring(L, 2)) { + luaL_error(L, "Usage: %s:SetDrawLayer(\"layer\")", texture->GetDisplayName()); + return 0; + } + + auto drawlayerStr = lua_tostring(L, 2); + int32_t drawlayer = texture->m_drawlayer; + + if (!StringToDrawLayer(drawlayerStr, drawlayer)) { + luaL_error(L, "Usage: %s:SetDrawLayer(\"layer\")", texture->GetDisplayName()); + return 0; + } + + texture->SetFrame(texture->m_parent, drawlayer, texture->m_shown); + + return 0; } int32_t CSimpleTexture_GetBlendMode(lua_State* L) {