Skip to content

Commit 6794b4d

Browse files
committed
UI/XUI: Fix button text/background color + slider styling
1 parent 0f61c10 commit 6794b4d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

shared/CP_SDK/XUI/Generics/XUIPOrSButton.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ namespace CP_SDK::XUI {
112112
t_Base* SetHeight(float p_Height) XUI_PROXY_IMPL_EX(t_Component, { x->SetHeight(p_Height); })
113113

114114
public:
115+
/// @brief Set button background color
116+
/// @param p_Color New color
117+
t_Base* SetBackgroundColor(Color p_Color) XUI_PROXY_IMPL_EX(t_Component, { x->SetBackgroundColor(p_Color); })
115118
/// @brief Set button background sprite
116119
/// @param p_Sprite New sprite
117120
t_Base* SetBackgroundSprite(_u::Sprite* p_Sprite) XUI_PROXY_IMPL_EX(t_Component, { x->SetBackgroundSprite(p_Sprite); })
121+
/// @brief Set button text color
122+
/// @param p_Color New color
123+
t_Base* SetColor(Color p_Color) XUI_PROXY_IMPL_EX(t_Component, { x->SetColor(p_Color); })
118124
/// @brief Set font size
119125
/// @param p_Size New size
120126
t_Base* SetFontSize(float p_Size) XUI_PROXY_IMPL_EX(t_Component, { x->SetFontSize(p_Size); })

src/CP_SDK/UI/Components/Generics/CPOrSButton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ namespace CP_SDK::UI::Components {
9494
/// @param p_Color New color
9595
CPOrSButton* CPOrSButton::SetColor(Color p_Color)
9696
{
97-
BackgroundImageC()->set_color(p_Color);
97+
TextC()->SetColor(p_Color);
9898
return this;
9999
}
100100
/// @brief Set button icon sprite

src/CP_SDK/UI/DefaultComponents/DefaultCSlider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ namespace CP_SDK::UI::DefaultComponents {
219219
m_OnColor = p_Color;
220220
m_OffColor = p_Color;
221221

222-
m_DecButton->SetColor(p_Color);
223-
m_IncButton->SetColor(p_Color);
222+
m_DecButton->SetBackgroundColor(p_Color);
223+
m_IncButton->SetBackgroundColor(p_Color);
224224

225225
UpdateStyle();
226226
}
@@ -537,8 +537,8 @@ namespace CP_SDK::UI::DefaultComponents {
537537
void DefaultCSlider::UpdateStyle()
538538
{
539539
auto l_IsInteractable = IsInteractable();
540-
m_DecButton->SetColor(l_IsInteractable ? m_OnColor : m_OffColor);
541-
m_IncButton->SetColor(l_IsInteractable ? m_OnColor : m_OffColor);
540+
m_DecButton->SetBackgroundColor(l_IsInteractable ? m_OnColor : m_OffColor);
541+
m_IncButton->SetBackgroundColor(l_IsInteractable ? m_OnColor : m_OffColor);
542542

543543
if (m_LeftMouseButtonPressed || m_LastPointerEvent)
544544
{

0 commit comments

Comments
 (0)