mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): implement CSimpleFrame_SetScale
This commit is contained in:
parent
6c6e60e8f8
commit
a6e6d36ac1
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user