feat(ui): implement CSimpleFrame_SetScale

This commit is contained in:
fallenoak 2025-12-03 00:16:54 -06:00
parent 6c6e60e8f8
commit a6e6d36ac1
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -195,7 +195,29 @@ int32_t CSimpleFrame_GetScale(lua_State* L) {
}
int32_t CSimpleFrame_SetScale(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
auto type = CSimpleFrame::GetObjectType();
auto frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
if (!frame->ProtectedFunctionsAllowed()) {
// TODO
// - disallowed logic
return 0;
}
if (!lua_isnumber(L, 2)) {
return luaL_error(L, "Usage: %s:SetScale(scale)", frame->GetDisplayName());
}
auto scale = lua_tonumber(L, 2);
if (scale <= 0.0) {
return luaL_error(L, "%s:SetScale(): Scale must be > 0", frame->GetDisplayName());
}
frame->SetFrameScale(scale, false);
return 0;
}
int32_t CSimpleFrame_GetEffectiveAlpha(lua_State* L) {