Skip to content

Commit 03ffc26

Browse files
authored
TouchScreenGUI: Add an exit / "ESC" button to the rare controls bar (luanti-org#13574)
1 parent 7c26cb1 commit 03ffc26

File tree

6 files changed

+123
-1
lines changed

6 files changed

+123
-1
lines changed

LICENSE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ DS:
8787
games/devtest/mods/soundstuff/sounds/soundstuff_sinus.ogg
8888
games/devtest/mods/testtools/textures/testtools_branding_iron.png
8989

90+
grorp:
91+
textures/base/pack/exit_btn.png
92+
9093
License of Minetest source code
9194
-------------------------------
9295

android/icons/exit_btn.svg

Lines changed: 111 additions & 0 deletions
Loading

doc/texture_packs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ are placeholders intended to be overwritten by the game.
152152
* `debug_btn.png`
153153
* `gear_icon.png`
154154
* `rare_controls.png`
155+
* `exit_btn.png`
155156

156157
Texture Overrides
157158
-----------------

src/gui/touchscreengui.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ const char **joystick_imagenames = (const char *[]) {
5050

5151
static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
5252
{
53+
// ESC isn't part of the keymap.
54+
if (id == exit_id) {
55+
return KEY_ESCAPE;
56+
}
57+
5358
std::string key = "";
5459
switch (id) {
5560
case inventory_id:
@@ -548,9 +553,10 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
548553
+ (0.5 * button_size)),
549554
AHBB_Dir_Left_Right, 2.0);
550555

551-
m_rarecontrolsbar.addButton(chat_id, L"Chat", "chat_btn.png");
556+
m_rarecontrolsbar.addButton(chat_id, L"chat", "chat_btn.png");
552557
m_rarecontrolsbar.addButton(inventory_id, L"inv", "inventory_btn.png");
553558
m_rarecontrolsbar.addButton(drop_id, L"drop", "drop_btn.png");
559+
m_rarecontrolsbar.addButton(exit_id, L"exit", "exit_btn.png");
554560

555561
m_initialized = true;
556562
}

src/gui/touchscreengui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ typedef enum
5454
chat_id,
5555
inventory_id,
5656
drop_id,
57+
exit_id,
5758
joystick_off_id,
5859
joystick_bg_id,
5960
joystick_center_id

textures/base/pack/exit_btn.png

453 Bytes
Loading

0 commit comments

Comments
 (0)