feat(ui): implement CSimpleButton_GetTextHeight

This commit is contained in:
fallenoak 2026-02-02 21:09:56 -06:00
parent b076c2c573
commit f42416bd0b
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -372,7 +372,18 @@ int32_t CSimpleButton_GetTextWidth(lua_State* L) {
} }
int32_t CSimpleButton_GetTextHeight(lua_State* L) { int32_t CSimpleButton_GetTextHeight(lua_State* L) {
WHOA_UNIMPLEMENTED(0); auto type = CSimpleButton::GetObjectType();
auto button = static_cast<CSimpleButton*>(FrameScript_GetObjectThis(L, type));
auto text = button->m_text;
float height = text ? text->GetHeight() : 0.0f;
float ddcHeight = CoordinateGetAspectCompensation() * 1024.0f * height;
float ndcHeight = DDCToNDCWidth(ddcHeight);
lua_pushnumber(L, ndcHeight);
return 1;
} }
int32_t CSimpleButton_RegisterForClicks(lua_State* L) { int32_t CSimpleButton_RegisterForClicks(lua_State* L) {