Making the default button stand out

This commit is contained in:
noffie 2024-12-22 21:30:08 +01:00
parent 8ccaaca579
commit d375f9ca7d
2 changed files with 126 additions and 119 deletions

View file

@ -6,13 +6,13 @@
class GuiMovableWindow : public sva::GuiComponent
{
private:
private:
bool m_DragWindow = false;
Vector2 m_PanOffset = { 0,0 };
protected:
protected:
Rectangle m_WndRect = { 20,20, 200, 100 };
bool m_WindowOpen = true;
public:
public:
virtual int input() override
{
@ -63,7 +63,7 @@ class SafeClosePopup final : public GuiMovableWindow
bool m_CQB_YesButton = false;
bool m_CQB_NoButton = false;
public:
public:
~SafeClosePopup() {
CloseWindow();
@ -93,7 +93,13 @@ class SafeClosePopup final : public GuiMovableWindow
anchor03 = { m_WndRect.x + 168, m_WndRect.y + 88 };
m_WindowOpen = !GuiWindowBox(m_WndRect, "#191# Are you sure you want to close this program?");
int border_color = GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL);
int base_color = GuiGetStyle(DEFAULT, BASE_COLOR_NORMAL);
GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x7192C2FF);
GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xBBCDD3FF);
m_CQB_YesButton = GuiButton({ anchor03.x + -152, anchor03.y + 32, 120, 24 }, "#112#Yes");
GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, border_color);
GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, base_color);
m_CQB_NoButton = GuiButton({ anchor03.x + 24, anchor03.y + 32, 120, 24 }, "#113#No");
GuiLabel({ anchor03.x + -104, anchor03.y + -40, 208, 24 }, "Are you sure you want to close this?");
GuiLabel({ anchor03.x + -56, anchor03.y + -8, 120, 24 }, "Press \"Yes\" to close");
@ -124,7 +130,7 @@ class SafeClosePopup final : public GuiMovableWindow
m_WndRect = { anchor03.x + -168, anchor03.y + -88, 328, 160 };
}
public:
public:
void OpenWindow() {
GuiLock();
m_WindowOpen = true;
@ -138,7 +144,7 @@ class SafeClosePopup final : public GuiMovableWindow
class SettingsComponent final : public sva::GuiComponent {
public:
public:
struct {
bool borderlessFullscreen;
uint32_t state;
@ -150,7 +156,7 @@ class SettingsComponent final : public sva::GuiComponent {
}
int draw() override {
if(GuiButton({100, 100, 300, 30}, "This should not work when the safe window is open!")) {
if (GuiButton({ 100, 100, 300, 30 }, "This should not work when the safe window is open!")) {
std::cout << "got pressed\n";
}
return 0;

View file

@ -76,7 +76,6 @@ int main(int argc, char** argv)
ComponentStack::push<SettingsComponent>();
// always on top...
SafeClosePopup safe_close_popup;
safe_close_popup.attach(&is_running);
@ -114,6 +113,8 @@ int main(int argc, char** argv)
switch (run_result)
{
case 1:
return 0;
case 2:
spdlog::warn("Program exiting abnormally.");
break;
@ -121,5 +122,5 @@ int main(int argc, char** argv)
break;
}
return 0;
return run_result;
}