From 03ffc2618cb73ef78070ee4c6fe59a143a6c1407 Mon Sep 17 00:00:00 2001 From: Gregor Parzefall <82708541+grorp@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:50:36 +0200 Subject: [PATCH] TouchScreenGUI: Add an exit / "ESC" button to the rare controls bar (#13574) --- LICENSE.txt | 3 + android/icons/exit_btn.svg | 111 ++++++++++++++++++++++++++++++++ doc/texture_packs.md | 1 + src/gui/touchscreengui.cpp | 8 ++- src/gui/touchscreengui.h | 1 + textures/base/pack/exit_btn.png | Bin 0 -> 453 bytes 6 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 android/icons/exit_btn.svg create mode 100644 textures/base/pack/exit_btn.png diff --git a/LICENSE.txt b/LICENSE.txt index d7316a0bf..a171e4052 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -87,6 +87,9 @@ DS: games/devtest/mods/soundstuff/sounds/soundstuff_sinus.ogg games/devtest/mods/testtools/textures/testtools_branding_iron.png +grorp: + textures/base/pack/exit_btn.png + License of Minetest source code ------------------------------- diff --git a/android/icons/exit_btn.svg b/android/icons/exit_btn.svg new file mode 100644 index 000000000..5dd642e83 --- /dev/null +++ b/android/icons/exit_btn.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/doc/texture_packs.md b/doc/texture_packs.md index 2e595449e..c1bd1dd86 100644 --- a/doc/texture_packs.md +++ b/doc/texture_packs.md @@ -152,6 +152,7 @@ are placeholders intended to be overwritten by the game. * `debug_btn.png` * `gear_icon.png` * `rare_controls.png` +* `exit_btn.png` Texture Overrides ----------------- diff --git a/src/gui/touchscreengui.cpp b/src/gui/touchscreengui.cpp index b16bcc820..531b7708e 100644 --- a/src/gui/touchscreengui.cpp +++ b/src/gui/touchscreengui.cpp @@ -50,6 +50,11 @@ const char **joystick_imagenames = (const char *[]) { static irr::EKEY_CODE id2keycode(touch_gui_button_id id) { + // ESC isn't part of the keymap. + if (id == exit_id) { + return KEY_ESCAPE; + } + std::string key = ""; switch (id) { case inventory_id: @@ -548,9 +553,10 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) + (0.5 * button_size)), AHBB_Dir_Left_Right, 2.0); - m_rarecontrolsbar.addButton(chat_id, L"Chat", "chat_btn.png"); + m_rarecontrolsbar.addButton(chat_id, L"chat", "chat_btn.png"); m_rarecontrolsbar.addButton(inventory_id, L"inv", "inventory_btn.png"); m_rarecontrolsbar.addButton(drop_id, L"drop", "drop_btn.png"); + m_rarecontrolsbar.addButton(exit_id, L"exit", "exit_btn.png"); m_initialized = true; } diff --git a/src/gui/touchscreengui.h b/src/gui/touchscreengui.h index 2b00744c3..b91aca9dd 100644 --- a/src/gui/touchscreengui.h +++ b/src/gui/touchscreengui.h @@ -54,6 +54,7 @@ typedef enum chat_id, inventory_id, drop_id, + exit_id, joystick_off_id, joystick_bg_id, joystick_center_id diff --git a/textures/base/pack/exit_btn.png b/textures/base/pack/exit_btn.png new file mode 100644 index 0000000000000000000000000000000000000000..9769a18d423f52f0559982bbadefcc5c148d474a GIT binary patch literal 453 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H0wgodS2{2-F!p%5IEGZ*dV9y-i`h}e{Uc|b zgN{wp($?Oo35m0%S@<8!Hxl2leZvVwog5ZxY1aM;PO1+Cw+L)GDa^S@FDHFk zSvSd_P_s7v(=`(TwjS${PV?UTZfDBupwylh%fii8sXUmr&T6G_f>*dNi-zbo<_EQ$ z{ri{OG5ToM%f4pfP-tL45S*bJ4}huD{-n~bm+Yr;RUz& zH5(Wt8F(z7^kuhAIsb{_n9i(X2TfJ}2ZD8iEX+C_j~I?!P~c#eFvt{;naFa%X#y4; zAkSbO^YK8A=XLMq2Qzjt+<4NfH+!>tD8urSyE_>|8JE|MwTD)3=i9vJnBE$DnF&iUh8#YCL@c0 z0|Sg$P}lIo(5kzMU9*+x2!F7*{Bm*ofQx6~V9ohjhF>-=-M??Yo(GH`22WQ%mvv4F FO#qjlvmgKf literal 0 HcmV?d00001