From 8bf72708af09963ca139572cb031420e078ee0be Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 5 Apr 2026 23:10:50 -0700
Subject: [PATCH] Make it clearer that you can click on the lobby control
buttons
---
Data/UI/lobby.xml | 24 ++++++++++++++++++------
game/MacDialog.cpp | 21 +++++++++++++++------
game/MacDialog.h | 14 ++++++++++++--
game/MaelstromUI.cpp | 2 ++
game/gameinfo.cpp | 2 +-
5 files changed, 48 insertions(+), 15 deletions(-)
diff --git a/Data/UI/lobby.xml b/Data/UI/lobby.xml
index 4c299bdb..8f9c2f8c 100644
--- a/Data/UI/lobby.xml
+++ b/Data/UI/lobby.xml
@@ -164,9 +164,13 @@
<Image name="label" image="player1">
<Anchor anchorFrom="TOPLEFT" anchorTo="TOPLEFT"/>
</Image>
- <Button name="control">
+ <RoundedButton name="control">
+ <Size w="40" h="40"/>
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="16"/>
- </Button>
+ <Elements>
+ <Image name="control_image"/>
+ </Elements>
+ </RoundedButton>
<DialogLabel name="desc">
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="80"/>
</DialogLabel>
@@ -195,9 +199,13 @@
<Image name="label" image="player2">
<Anchor anchorFrom="TOPLEFT" anchorTo="TOPLEFT"/>
</Image>
- <Button name="control">
+ <RoundedButton name="control">
+ <Size w="40" h="40"/>
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="16"/>
- </Button>
+ <Elements>
+ <Image name="control_image"/>
+ </Elements>
+ </RoundedButton>
<DialogLabel name="desc">
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="80"/>
</DialogLabel>
@@ -226,9 +234,13 @@
<Image name="label" image="player3">
<Anchor anchorFrom="TOPLEFT" anchorTo="TOPLEFT"/>
</Image>
- <Button name="control">
+ <RoundedButton name="control">
+ <Size w="40" h="40"/>
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="16"/>
- </Button>
+ <Elements>
+ <Image name="control_image"/>
+ </Elements>
+ </RoundedButton>
<DialogLabel name="desc">
<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="label" x="80"/>
</DialogLabel>
diff --git a/game/MacDialog.cpp b/game/MacDialog.cpp
index 4282a4bb..0a8271ab 100644
--- a/game/MacDialog.cpp
+++ b/game/MacDialog.cpp
@@ -150,16 +150,15 @@ MacDialogDrawEngine::Init(UIElement *element)
//////////////////////////////////////////////////////////////////////////////
void
-MacDialogButton::Init(UIElement *element)
+MacRoundedButton::Init(UIElement *element)
{
MacDialogDrawEngine::Init(element);
m_element->SetFill(true);
- m_element->SetSize(BUTTON_WIDTH, BUTTON_HEIGHT);
}
void
-MacDialogButton::OnLoad()
+MacRoundedButton::OnLoad()
{
MacDialogDrawEngine::OnLoad();
@@ -168,7 +167,7 @@ MacDialogButton::OnLoad()
}
void
-MacDialogButton::OnDraw()
+MacRoundedButton::OnDraw()
{
Uint32 color;
int x, y, maxx, maxy;
@@ -247,7 +246,7 @@ MacDialogButton::OnDraw()
}
void
-MacDialogButton::OnMouseDown()
+MacRoundedButton::OnMouseDown()
{
MacDialogDrawEngine::OnMouseDown();
@@ -257,7 +256,7 @@ MacDialogButton::OnMouseDown()
}
void
-MacDialogButton::OnMouseUp()
+MacRoundedButton::OnMouseUp()
{
MacDialogDrawEngine::OnMouseUp();
@@ -268,6 +267,16 @@ MacDialogButton::OnMouseUp()
//////////////////////////////////////////////////////////////////////////////
+void
+MacDialogButton::Init(UIElement *element)
+{
+ MacRoundedButton::Init(element);
+
+ m_element->SetSize(BUTTON_WIDTH, BUTTON_HEIGHT);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
void
MacDialogCheckbox::Init(UIElement *element)
{
diff --git a/game/MacDialog.h b/game/MacDialog.h
index da84fb27..22fe683b 100644
--- a/game/MacDialog.h
+++ b/game/MacDialog.h
@@ -60,10 +60,10 @@ class MacDialogDrawEngine : public UIDrawEngine
//////////////////////////////////////////////////////////////////////////////
-class MacDialogButton : public MacDialogDrawEngine
+class MacRoundedButton : public MacDialogDrawEngine
{
public:
- MacDialogButton() : MacDialogDrawEngine() { }
+ MacRoundedButton() : MacDialogDrawEngine() { }
virtual void Init(UIElement *element) override;
virtual void OnLoad() override;
@@ -77,6 +77,16 @@ class MacDialogButton : public MacDialogDrawEngine
//////////////////////////////////////////////////////////////////////////////
+class MacDialogButton : public MacRoundedButton
+{
+public:
+ MacDialogButton() : MacRoundedButton() { }
+
+ virtual void Init(UIElement *element) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
class MacDialogCheckbox : public MacDialogDrawEngine
{
public:
diff --git a/game/MaelstromUI.cpp b/game/MaelstromUI.cpp
index 8f194a27..e7872e05 100644
--- a/game/MaelstromUI.cpp
+++ b/game/MaelstromUI.cpp
@@ -420,6 +420,8 @@ MaelstromUI::CreateElement(UIBaseElement *parent, const char *type, const char *
element = new UIContainer(parent, name, new UIDrawEngine());
} else if (SDL_strcasecmp(type, "Button") == 0) {
element = new UIElementButton(parent, name, new UIDrawEngine());
+ } else if (SDL_strcasecmp(type, "RoundedButton") == 0) {
+ element = new UIElementButton(parent, name, new MacRoundedButton());
} else if (SDL_strcasecmp(type, "Checkbox") == 0) {
element = new UIElementCheckbox(parent, name, new UIDrawEngine());
} else if (SDL_strcasecmp(type, "Thumbstick") == 0) {
diff --git a/game/gameinfo.cpp b/game/gameinfo.cpp
index 9b6ddc74..3e20a3c4 100644
--- a/game/gameinfo.cpp
+++ b/game/gameinfo.cpp
@@ -497,7 +497,7 @@ GameInfo::BindPlayerToUI(int index, UIElement *element)
player->UI.desc = element->GetElement<UIElement>("desc");
player->UI.name = element->GetElement<UIElement>("name");
player->UI.host = element->GetElement<UIElement>("host");
- player->UI.control = element->GetElement<UIElement>("control");
+ player->UI.control = element->GetElement<UIElement>("control_image");
for (int i = 0; i < NUM_PING_STATES; ++i) {
SDL_snprintf(name, sizeof(name), "ping%d", i);