diff --git a/src/gui/CBaseButton.cpp b/src/gui/CBaseButton.cpp index 4de1e007..06b88abe 100644 --- a/src/gui/CBaseButton.cpp +++ b/src/gui/CBaseButton.cpp @@ -21,13 +21,13 @@ void CBaseButton::SetCallback(ButtonCallbackFn_t callback) { } void CBaseButton::Draw(int x, int y) { - int textcolor = colors::pink; + int textcolor = GUIColor(); auto size = GetSize(); if (IsPressed()) { - draw::DrawRect(x, y, size.first, size.second, colors::pink); + draw::DrawRect(x, y, size.first, size.second, GUIColor()); textcolor = colors::white; } - draw::OutlineRect(x, y, size.first, size.second, colors::pink); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); draw::String(fonts::MENU, x + Props()->GetInt("padding_x"), y + Props()->GetInt("padding_y"), textcolor, 1, GetText()); } diff --git a/src/gui/CBaseWindow.cpp b/src/gui/CBaseWindow.cpp index b9306563..428bcfae 100644 --- a/src/gui/CBaseWindow.cpp +++ b/src/gui/CBaseWindow.cpp @@ -46,6 +46,6 @@ void CBaseWindow::Draw(int x, int y) { auto abs = AbsolutePosition(); auto size = GetSize(); draw::DrawRect(abs.first, abs.second, size.first, size.second, colors::Transparent(colors::black, 0.9)); - draw::OutlineRect(abs.first, abs.second, size.first, size.second, colors::pink); + draw::OutlineRect(abs.first, abs.second, size.first, size.second, GUIColor()); CBaseContainer::Draw(x, y); } diff --git a/src/gui/CCTitleBar.cpp b/src/gui/CCTitleBar.cpp index 2939f48c..02410ae2 100644 --- a/src/gui/CCTitleBar.cpp +++ b/src/gui/CCTitleBar.cpp @@ -22,7 +22,7 @@ CTitleBar::CTitleBar(IWidget* parent, std::string title) : CBaseWidget("titlebar void CTitleBar::Draw(int x, int y) { auto size = GetSize(); - draw::DrawRect(x, y, size.first, size.second, colors::pink); + draw::DrawRect(x, y, size.first, size.second, GUIColor()); int l, h; draw::GetStringLength(fonts::MENU, (char*)m_strTitle.c_str(), l, h); draw::String(fonts::MENU, x + (size.first - l) / 2, y + TITLEBAR_PADDING_H, colors::white, 1, m_strTitle.c_str()); diff --git a/src/gui/CCheckbox.cpp b/src/gui/CCheckbox.cpp index d461786f..b169112f 100644 --- a/src/gui/CCheckbox.cpp +++ b/src/gui/CCheckbox.cpp @@ -22,9 +22,9 @@ void CCheckbox::SetWidth(int width) { void CCheckbox::Draw(int x, int y) { auto size = GetSize(); - draw::OutlineRect(x, y, size.first, size.second, colors::pink); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); if (Value()) { - draw::DrawRect(x + 3, y + 3, size.first - 6, size.second - 6, colors::pink); + draw::DrawRect(x + 3, y + 3, size.first - 6, size.second - 6, GUIColor()); } } diff --git a/src/gui/CDropdown.cpp b/src/gui/CDropdown.cpp index 75c313be..ca82193b 100644 --- a/src/gui/CDropdown.cpp +++ b/src/gui/CDropdown.cpp @@ -44,10 +44,10 @@ void CDropdown::Draw(int x, int y) { auto size = GetSize(); auto ssize = draw::GetStringLength(fonts::MENU, ValueName(Value() - Props()->GetInt("offset"))); draw::DrawRect(x, y, size.first, size.second, colors::Transparent(colors::black)); - draw::OutlineRect(x, y, size.first, size.second, colors::pink); - draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, colors::pink, 1, ValueName(Value() - Props()->GetInt("offset"))); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); + draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, GUIColor(), 1, ValueName(Value() - Props()->GetInt("offset"))); auto asize = draw::GetStringLength(fonts::MENU, ">"); - draw::String(fonts::MENU, x + size.first - asize.first - 2, y + (size.second - asize.second) / 2, colors::pink, 1, ">"); + draw::String(fonts::MENU, x + size.first - asize.first - 2, y + (size.second - asize.second) / 2, GUIColor(), 1, ">"); } void CDropdown::OnFocusLose() { diff --git a/src/gui/CDropdownEntry.cpp b/src/gui/CDropdownEntry.cpp index 8aff2cc6..ef390d73 100644 --- a/src/gui/CDropdownEntry.cpp +++ b/src/gui/CDropdownEntry.cpp @@ -22,7 +22,7 @@ CDropdownEntry::CDropdownEntry(std::string name, CDropdownList* parent, std::str void CDropdownEntry::Draw(int x, int y) { auto ssize = draw::GetStringLength(fonts::MENU, GetText()); auto size = GetSize(); - draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, colors::pink, 1, GetText()); + draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, GUIColor(), 1, GetText()); } CDropdownEntry::~CDropdownEntry() { diff --git a/src/gui/CDropdownList.cpp b/src/gui/CDropdownList.cpp index d073ceaf..50bfb28d 100644 --- a/src/gui/CDropdownList.cpp +++ b/src/gui/CDropdownList.cpp @@ -41,7 +41,7 @@ void CDropdownList::SetValue(int value) { void CDropdownList::Draw(int x, int y) { auto size = GetSize(); draw::DrawRect(x, y, size.first, size.second, colors::Transparent(colors::black, 0.85)); - draw::OutlineRect(x, y, size.first, size.second, colors::pink); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); CBaseContainer::Draw(x, y); } diff --git a/src/gui/CKeyInput.cpp b/src/gui/CKeyInput.cpp index 690b6eab..a3a0f391 100644 --- a/src/gui/CKeyInput.cpp +++ b/src/gui/CKeyInput.cpp @@ -28,7 +28,7 @@ void CKeyInput::Draw(int x, int y) { int color = colors::white; if (Props()->GetBool("capturing")) { key = "< PRESS >"; - color = colors::pink; + color = GUIColor(); } else { if (!Value()) { if (!IsFocused()) { diff --git a/src/gui/CMenuContainer.cpp b/src/gui/CMenuContainer.cpp index d35b86ff..562ede3e 100644 --- a/src/gui/CMenuContainer.cpp +++ b/src/gui/CMenuContainer.cpp @@ -37,6 +37,6 @@ void CMenuContainer::MoveChildren() { void CMenuContainer::Draw(int x, int y) { CBaseContainer::Draw(x, y); for (int i = 0; i < Props()->GetInt("columns"); i++) { - draw::DrawLine(x + (350 + 3) * (i + 1), y, 0, GetMaxSize().second, colors::pink); + draw::DrawLine(x + (350 + 3) * (i + 1), y, 0, GetMaxSize().second, GUIColor()); } } diff --git a/src/gui/CMenuListEntry.cpp b/src/gui/CMenuListEntry.cpp index 0ed0c1f2..cfbca3ba 100644 --- a/src/gui/CMenuListEntry.cpp +++ b/src/gui/CMenuListEntry.cpp @@ -28,14 +28,14 @@ void CMenuListEntry::Draw(int x, int y) { auto texts = draw::GetStringLength(fonts::MENU_BIG, GetText()); auto size = GetSize(); if (IsSelected()) { - draw::DrawLine(x, y, size.first, 0, colors::pink); - draw::DrawLine(x, y + size.second, size.first, 0, colors::pink); - draw::DrawLine(x, y, 0, size.second, colors::pink); + draw::DrawLine(x, y, size.first, 0, GUIColor()); + draw::DrawLine(x, y + size.second, size.first, 0, GUIColor()); + draw::DrawLine(x, y, 0, size.second, GUIColor()); } else { - draw::OutlineRect(x, y, size.first, size.second, colors::pink); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); } if (IsHovered()) { - draw::DrawRect(x, y, size.first, size.second, colors::Transparent(colors::pink, 0.25)); + draw::DrawRect(x, y, size.first, size.second, colors::Transparent(GUIColor(), 0.25)); } - draw::String(fonts::MENU_BIG, x + (size.first - texts.first) / 2, y + (size.second - texts.second) / 2, IsSelected() ? colors::white : colors::pink, 1, GetText()); + draw::String(fonts::MENU_BIG, x + (size.first - texts.first) / 2, y + (size.second - texts.second) / 2, IsSelected() ? colors::white : GUIColor(), 1, GetText()); } diff --git a/src/gui/CSlider.cpp b/src/gui/CSlider.cpp index 0a964204..9b37011b 100644 --- a/src/gui/CSlider.cpp +++ b/src/gui/CSlider.cpp @@ -72,7 +72,7 @@ void CSlider::Update() { void CSlider::Draw(int x, int y) { auto size = GetSize(); draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 200)); - draw::DrawRect(x, y, m_nSliderPos, size.second, colors::pink); + draw::DrawRect(x, y, m_nSliderPos, size.second, GUIColor()); char* s = strfmt("%.2f", Value()); std::string str(s); delete [] s; diff --git a/src/gui/CTextInput.cpp b/src/gui/CTextInput.cpp index bc7f4b14..5c1cfe73 100644 --- a/src/gui/CTextInput.cpp +++ b/src/gui/CTextInput.cpp @@ -39,9 +39,9 @@ void CTextInput::Draw(int x, int y) { auto wsize = draw::GetStringLength(fonts::MENU, "W"); auto size = GetSize(); int color = colors::Create(0, 0, 0, 80); - if (IsFocused()) color = colors::Transparent(colors::pink, 0.25); + if (IsFocused()) color = colors::Transparent(GUIColor(), 0.25); draw::DrawRect(x, y, size.first, size.second, color); - draw::OutlineRect(x, y, size.first, size.second, colors::pink); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); int ml = 0; int md = 0; auto dotssize = draw::GetStringLength(fonts::MENU, "..."); // TODO static? diff --git a/src/gui/CTooltip.cpp b/src/gui/CTooltip.cpp index 946447ba..6f8c23f8 100644 --- a/src/gui/CTooltip.cpp +++ b/src/gui/CTooltip.cpp @@ -22,6 +22,6 @@ CTooltip::CTooltip(IWidget* parent) : CTextLabel("tooltip", parent) { void CTooltip::Draw(int x, int y) { auto size = GetSize(); draw::DrawRect(x, y, size.first, size.second, colors::Create(0, 0, 0, 230)); - draw::OutlineRect(x, y, size.first, size.second, colors::pink); - draw::String(fonts::MENU, x + Props()->GetInt("padding_x"), y + Props()->GetInt("padding_y"), colors::pink, 1, GetText()); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); + draw::String(fonts::MENU, x + Props()->GetInt("padding_x"), y + Props()->GetInt("padding_y"), GUIColor(), 1, GetText()); } diff --git a/src/gui/GUI.cpp b/src/gui/GUI.cpp index 21fd3edc..432a6360 100644 --- a/src/gui/GUI.cpp +++ b/src/gui/GUI.cpp @@ -40,6 +40,15 @@ CatGUI::~CatGUI() { delete m_pRootWindow; } +CatVar gui_color_r(CV_INT, "gui_color_r", "255", "Main GUI color (red)", "Defines red component of main gui color", 0, 255); +CatVar gui_color_g(CV_INT, "gui_color_g", "105", "Main GUI color (green)", "Defines green component of main gui color", 0, 255); +CatVar gui_color_b(CV_INT, "gui_color_b", "180", "Main GUI color (blue)", "Defines blue component of main gui color", 0, 255); + +static CatVar gui_rainbow(CV_SWITCH, "gui_rainbow", "0", "Rainbow GUI"); +int GUIColor() { + return gui_rainbow ? colors::RainbowCurrent() : colors::Create((int)gui_color_r, (int)gui_color_g, (int)gui_color_b, 255); +} + void CatGUI::Setup() { m_pRootWindow = new RootWindow(); m_pRootWindow->Setup(); @@ -111,7 +120,7 @@ void CatGUI::Update() { if (!m_bShowTooltip && m_pTooltip->IsVisible()) m_pTooltip->Hide(); root->Draw(0, 0); draw::DrawRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, colors::Transparent(colors::white)); - draw::OutlineRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, gui_nullcore ? menu::ncc::color_fg : colors::pink); + draw::OutlineRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, GUIColor()); if (gui_draw_bounds) { root->DrawBounds(0, 0); } diff --git a/src/gui/GUI.h b/src/gui/GUI.h index 2f3690c5..ea370407 100644 --- a/src/gui/GUI.h +++ b/src/gui/GUI.h @@ -26,6 +26,11 @@ class CatVar; class CTooltip; class RootWindow; +extern CatVar gui_color_r; +extern CatVar gui_color_g; +extern CatVar gui_color_b; +int GUIColor(); + extern CatVar gui_visible; extern CatVar gui_draw_bounds; extern CatVar gui_nullcore; diff --git a/src/gui/ncc/Item.cpp b/src/gui/ncc/Item.cpp index 05245c15..2bbe7080 100644 --- a/src/gui/ncc/Item.cpp +++ b/src/gui/ncc/Item.cpp @@ -19,7 +19,7 @@ Item::Item() : CBaseWidget("ncc_menu_item", nullptr) { void Item::Draw(int x, int y) { const auto& size = GetSize(); - draw::DrawRect(x, y, size.first, size.second, IsHovered() ? color_bg_hover : color_bg); + draw::DrawRect(x, y, size.first, size.second, IsHovered() ? colors::Transparent(GUIColor(), 0.32f) : colors::Transparent(GUIColor(), 0.07f)); } }} diff --git a/src/gui/ncc/List.cpp b/src/gui/ncc/List.cpp index aa2ea090..6cd8af75 100644 --- a/src/gui/ncc/List.cpp +++ b/src/gui/ncc/List.cpp @@ -20,9 +20,9 @@ List::List(std::string title) : open_sublist(nullptr), title(title), items {} { void List::Draw(int x, int y) { const auto& size = GetSize(); - draw::OutlineRect(x, y, size.first, size.second, color_fg); + draw::OutlineRect(x, y, size.first, size.second, GUIColor()); for (int i = 1; i < ChildCount(); i++) { - draw::DrawLine(x + 1, y + 15 * i, 220, 0, color_fg); + draw::DrawLine(x + 1, y + 15 * i, 220, 0, GUIColor()); } CBaseContainer::Draw(x, y); } diff --git a/src/gui/ncc/Menu.hpp b/src/gui/ncc/Menu.hpp index 90142fb4..5f7054fe 100644 --- a/src/gui/ncc/Menu.hpp +++ b/src/gui/ncc/Menu.hpp @@ -17,10 +17,6 @@ namespace menu { namespace ncc { extern unsigned long font_title; // Verdana Bold 10px extern unsigned long font_item; // Verdana 10px -const int color_fg = colors::Create(255, 105, 180, 255);//colors::Create(15, 150, 150, 255); -const int color_bg = colors::Transparent(color_fg, 0.07f); -const int color_bg_hover = colors::Transparent(color_fg, 0.32f); - void Init(); List& MainList();