mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
chore(ui): replace sub_960420 with existing FrameScript_GetColor
This commit is contained in:
parent
6c76720c04
commit
03ba4ccbb1
1 changed files with 6 additions and 42 deletions
|
|
@ -9,42 +9,6 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
static int32_t sub_960420(lua_State* L, int idx, CImVector& color) {
|
|
||||||
auto red = lua_tonumber(L, idx++);
|
|
||||||
if (red < 0.0) {
|
|
||||||
red = 0.0;
|
|
||||||
}
|
|
||||||
if (red >= 1.0) {
|
|
||||||
red = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto green = lua_tonumber(L, idx++);
|
|
||||||
if (green < 0.0) {
|
|
||||||
green = 0.0;
|
|
||||||
}
|
|
||||||
if (green >= 1.0) {
|
|
||||||
green = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto blue = lua_tonumber(L, idx++);
|
|
||||||
if (blue < 0.0) {
|
|
||||||
blue = 0.0;
|
|
||||||
}
|
|
||||||
if (blue >= 1.0) {
|
|
||||||
blue = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto alpha = lua_isnumber(L, idx) ? lua_tonumber(L, idx++) : 1.0;
|
|
||||||
if (alpha < 0.0) {
|
|
||||||
alpha = 0.0;
|
|
||||||
}
|
|
||||||
if (alpha >= 1.0) {
|
|
||||||
alpha = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
color.Set(alpha, red, green, blue);
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetTitleRegion(lua_State* L) {
|
int32_t CSimpleFrame_GetTitleRegion(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
|
@ -499,10 +463,10 @@ int32_t CSimpleFrame_GetBackdropColor(lua_State* L) {
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetBackdropColor(lua_State* L) {
|
int32_t CSimpleFrame_SetBackdropColor(lua_State* L) {
|
||||||
int32_t type = CSimpleFrame::GetObjectType();
|
int32_t type = CSimpleFrame::GetObjectType();
|
||||||
CSimpleFrame* object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
auto object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
CImVector color;
|
CImVector color = { 0 };
|
||||||
sub_960420(L, 2, color);
|
FrameScript_GetColor(L, 2, color);
|
||||||
|
|
||||||
if (object->m_backdrop) {
|
if (object->m_backdrop) {
|
||||||
object->m_backdrop->SetVertexColor(color);
|
object->m_backdrop->SetVertexColor(color);
|
||||||
|
|
@ -517,10 +481,10 @@ int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) {
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) {
|
int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) {
|
||||||
int32_t type = CSimpleFrame::GetObjectType();
|
int32_t type = CSimpleFrame::GetObjectType();
|
||||||
CSimpleFrame* object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
auto object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
CImVector color;
|
CImVector color = { 0 };
|
||||||
sub_960420(L, 2, color);
|
FrameScript_GetColor(L, 2, color);
|
||||||
|
|
||||||
if (object->m_backdrop) {
|
if (object->m_backdrop) {
|
||||||
object->m_backdrop->SetBorderVertexColor(color);
|
object->m_backdrop->SetBorderVertexColor(color);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue