mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2026-02-04 09:09:09 +00:00
fix(ui): eliminate script errors
This commit is contained in:
parent
dbc140d1e4
commit
9d2b94b0cd
12 changed files with 121 additions and 20 deletions
|
|
@ -64,6 +64,10 @@ bool CScriptRegion::IsDragging() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CScriptRegion::IsMouseOver(float a1, float a2, float a3, float a4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CScriptRegion::LoadXML(XMLNode* node, CStatus* status) {
|
||||
CLayoutFrame::LoadXML(node, status);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class CScriptRegion : public CScriptObject, public CLayoutFrame {
|
|||
virtual bool IsA(const char* typeName);
|
||||
virtual const char* GetObjectTypeName();
|
||||
virtual bool IsDragging();
|
||||
virtual bool IsMouseOver(float a1, float a2, float a3, float a4);
|
||||
virtual void PreOnAnimUpdate() {};
|
||||
virtual void OnLayerUpdate(float elapsedSec);
|
||||
virtual void NotifyAnimBegin(CSimpleAnimGroup* animGroup);
|
||||
|
|
|
|||
|
|
@ -518,7 +518,23 @@ int32_t CScriptRegion_IsDragging(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t CScriptRegion_IsMouseOver(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
int32_t type = CScriptRegion::GetObjectType();
|
||||
auto region = static_cast<CScriptRegion*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
float rect[4];
|
||||
for (int32_t i = 0; i < 4; ++i) {
|
||||
if (lua_isnumber(L, i + 2)) {
|
||||
rect[i] = lua_tonumber(L, i + 2);
|
||||
rect[i] /= CoordinateGetAspectCompensation() * 1024.0f;
|
||||
rect[i] = NDCToDDCWidth(rect[i]);
|
||||
} else {
|
||||
rect[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
auto result = region->IsMouseOver(rect[0], rect[1], rect[2], rect[3]);
|
||||
lua_pushboolean(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
FrameScript_Method ScriptRegionMethods[NUM_SCRIPT_REGION_SCRIPT_METHODS] = {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ int32_t CSimpleButton_Disable(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t CSimpleButton_IsEnabled(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleButton::GetObjectType();
|
||||
auto button = static_cast<CSimpleButton*>(FrameScript_GetObjectThis(L, type));
|
||||
lua_pushnumber(L, button->GetButtonState() != BUTTONSTATE_DISABLED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleButton_GetButtonState(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -56,11 +56,25 @@ int32_t CSimpleFontString_Hide(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t CSimpleFontString_IsVisible(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleFontString::GetObjectType();
|
||||
auto string = static_cast<CSimpleFontString*>(FrameScript_GetObjectThis(L, type));
|
||||
if (string->m_visible) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleFontString_IsShown(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleFontString::GetObjectType();
|
||||
auto string = static_cast<CSimpleFontString*>(FrameScript_GetObjectThis(L, type));
|
||||
if (string->m_shown) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleFontString_GetFontObject(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -96,11 +96,25 @@ int32_t CSimpleTexture_Hide(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t CSimpleTexture_IsVisible(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleTexture::GetObjectType();
|
||||
auto texture = static_cast<CSimpleTexture*>(FrameScript_GetObjectThis(L, type));
|
||||
if (texture->m_visible) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_IsShown(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleTexture::GetObjectType();
|
||||
auto texture = static_cast<CSimpleTexture*>(FrameScript_GetObjectThis(L, type));
|
||||
if (texture->m_shown) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_GetTexture(lua_State* L) {
|
||||
|
|
@ -211,11 +225,15 @@ int32_t CSimpleTexture_SetRotation(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t CSimpleTexture_SetDesaturated(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_IsDesaturated(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_SetNonBlocking(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,9 @@ int32_t strlenutf8(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t issecure(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t issecurevariable(lua_State* L) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue