From 2d585c6b59c834e966214fb8c410ed2cf7be1f17 Mon Sep 17 00:00:00 2001 From: MoNTE48 Date: Fri, 25 Sep 2020 12:51:46 +0200 Subject: [PATCH] Backport Minetest 5 TouchScreenGUI Joystick --- src/touchscreengui.cpp | 581 +++++++++++++++++------------ src/touchscreengui.h | 115 +++--- textures/base/down_one_btn.png | Bin 283 -> 0 bytes textures/base/down_one_press.png | Bin 627 -> 0 bytes textures/base/down_three_btn.png | Bin 278 -> 0 bytes textures/base/down_three_press.png | Bin 639 -> 0 bytes textures/base/down_two_btn.png | Bin 242 -> 0 bytes textures/base/down_two_press.png | Bin 595 -> 0 bytes textures/base/empty_btn.png | Bin 221 -> 0 bytes textures/base/joystick_bg.png | Bin 0 -> 814 bytes textures/base/joystick_center.png | Bin 0 -> 296 bytes textures/base/joystick_off.png | Bin 0 -> 1039 bytes textures/base/left_btn.png | Bin 220 -> 0 bytes textures/base/left_press.png | Bin 504 -> 0 bytes textures/base/right_btn.png | Bin 259 -> 0 bytes textures/base/right_press.png | Bin 570 -> 0 bytes textures/base/up_one_btn.png | Bin 280 -> 0 bytes textures/base/up_one_press.png | Bin 630 -> 0 bytes textures/base/up_three_btn.png | Bin 262 -> 0 bytes textures/base/up_three_press.png | Bin 586 -> 0 bytes textures/base/up_two_btn.png | Bin 234 -> 0 bytes textures/base/up_two_press.png | Bin 575 -> 0 bytes 22 files changed, 420 insertions(+), 276 deletions(-) delete mode 100644 textures/base/down_one_btn.png delete mode 100755 textures/base/down_one_press.png delete mode 100644 textures/base/down_three_btn.png delete mode 100755 textures/base/down_three_press.png delete mode 100644 textures/base/down_two_btn.png delete mode 100755 textures/base/down_two_press.png delete mode 100755 textures/base/empty_btn.png create mode 100644 textures/base/joystick_bg.png create mode 100644 textures/base/joystick_center.png create mode 100644 textures/base/joystick_off.png delete mode 100644 textures/base/left_btn.png delete mode 100755 textures/base/left_press.png delete mode 100644 textures/base/right_btn.png delete mode 100755 textures/base/right_press.png delete mode 100644 textures/base/up_one_btn.png delete mode 100755 textures/base/up_one_press.png delete mode 100644 textures/base/up_three_btn.png delete mode 100755 textures/base/up_three_press.png delete mode 100644 textures/base/up_two_btn.png delete mode 100755 textures/base/up_two_press.png diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp index 1263e71f..d7071f54 100644 --- a/src/touchscreengui.cpp +++ b/src/touchscreengui.cpp @@ -1,5 +1,7 @@ /* Copyright (C) 2014 sapier +Copyright (C) 2018 srifqi, Muhammad Rifqi Priyo Susanto + Copyright (C) 2014-2020 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua This program is free software; you can redistribute it and/or modify @@ -18,9 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "touchscreengui.h" +#include "irrlichttypes.h" +#include "irr_v2d.h" #include "log.h" #include "keycode.h" #include "settings.h" +#include "gettime.h" +#include "util/numeric.h" #include "porting.h" #include "guiscalingfilter.h" @@ -29,51 +35,41 @@ with this program; if not, write to the Free Software Foundation, Inc., using namespace irr::core; -const char *button_imagenames[][2] = { - {"up_one_btn.png", "up_one_press.png"}, - {"up_two_btn.png","up_two_press.png"}, - {"up_three_btn.png", "up_three_press.png"}, - {"down_one_btn.png", "down_one_press.png"}, - {"down_two_btn.png", "down_two_press.png"}, - {"down_three_btn.png", "down_three_press.png"}, - {"left_btn.png", "left_press.png"}, - {"right_btn.png", "right_press.png"}, - {"empty_btn.png"}, - {"inventory_btn.png"}, - {"drop_btn.png"}, - {"jump_btn.png"}, - {"down_btn.png"}, - {"escape_btn.png"}, - {"minimap_btn.png"}, - {"rangeview_btn.png"}, - {"camera_btn.png"}, - {"chat_btn.png"} -// {"noclip_btn.png"}, -// {"fast_btn.png"} +const char **button_imagenames = (const char *[]) { + "inventory_btn.png", + "drop_btn.png", + "jump_btn.png", + "down_btn.png", + "escape_btn.png", + "minimap_btn.png", + "rangeview_btn.png", + "camera_btn.png", + "chat_btn.png" +// "noclip_btn.png", +// "fast_btn.png" +}; + +const char **joystick_imagenames = (const char *[]) { + "joystick_off.png", + "joystick_bg.png", + "joystick_center.png" }; static irr::EKEY_CODE id2keycode(touch_gui_button_id id) { std::string key = ""; switch (id) { - case forward_one: - case forward_two: - case forward_three: + case forward_id: key = "forward"; break; - case backward_one: - case backward_two: - case backward_three: - key = "backward"; - break; case left_id: key = "left"; break; case right_id: key = "right"; break; - case empty_id: - key = "forward"; + case backward_id: + key = "backward"; break; case inventory_id: key = "inventory"; @@ -107,7 +103,7 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id) case fast_id: key = "fast"; break; */ - case after_last_element_id: + default: break; } assert(!key.empty()); @@ -116,39 +112,23 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id) TouchScreenGUI *g_touchscreengui; -static void load_button_texture(button_info *btn, touch_gui_button_id id, - const rect &button_rect, ISimpleTextureSource *tsrc, - video::IVideoDriver *driver) +static void load_button_texture(button_info *btn, const char *path, + const rect &button_rect, ISimpleTextureSource *tsrc, video::IVideoDriver *driver) { - - const char *path = button_imagenames[id][0]; - const char *path_pressed = button_imagenames[id][1] ? button_imagenames[id][1] : path; - unsigned int tid; video::ITexture *texture = guiScalingImageButton(driver, - tsrc->getTexture(path, &tid), - button_rect.getWidth(), - button_rect.getHeight()); - - video::ITexture *texture_pressed = texture; - if (strcmp(path, path_pressed) != 0) { - texture_pressed = guiScalingImageButton(driver, - tsrc->getTexture(path_pressed, &tid), - button_rect.getWidth(), - button_rect.getHeight()); - texture_pressed = texture_pressed ? texture_pressed : texture; - } - + tsrc->getTexture(path, &tid), button_rect.getWidth(), + button_rect.getHeight()); if (texture) { btn->guibutton->setUseAlphaChannel(true); if (g_settings->getBool("gui_scaling_filter")) { rect txr_rect = rect(0, 0, button_rect.getWidth(), button_rect.getHeight()); btn->guibutton->setImage(texture, txr_rect); - btn->guibutton->setPressedImage(texture_pressed, txr_rect); + btn->guibutton->setPressedImage(texture, txr_rect); btn->guibutton->setScaleImage(false); } else { btn->guibutton->setImage(texture); - btn->guibutton->setPressedImage(texture_pressed); + btn->guibutton->setPressedImage(texture); btn->guibutton->setScaleImage(true); } btn->guibutton->setDrawBorder(false); @@ -156,32 +136,28 @@ static void load_button_texture(button_info *btn, touch_gui_button_id id, } } -TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver) : +TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver): m_device(device), m_guienv(device->getGUIEnvironment()), - m_camera_yaw_change(0.0), - m_camera_pitch(0.0), m_visible(false), - m_move_id(-1), - m_receiver(receiver), - m_move_has_really_moved(false), - m_move_downtime(0), - m_move_sent_as_mouse_event(false) + m_receiver(receiver) { - for (auto & m_button : m_buttons) { - m_button.guibutton = nullptr; - m_button.repeatcounter = -1; - m_button.repeatdelay = BUTTON_REPEAT_DELAY; + for (auto &button : m_buttons) { + button.guibutton = nullptr; + button.repeatcounter = -1; + button.repeatdelay = BUTTON_REPEAT_DELAY; } m_touchscreen_threshold = g_settings->getU16("touchscreen_threshold"); m_screensize = m_device->getVideoDriver()->getScreenSize(); + button_size = MYMIN(m_screensize.Y / 4.5f, + porting::getDisplayDensity() * + g_settings->getFloat("hud_scaling") * 65.0f); } void TouchScreenGUI::initButton(touch_gui_button_id id, const rect &button_rect, - const std::wstring &caption, bool immediate_release, float repeat_delay) + const std::wstring &caption, bool immediate_release, float repeat_delay) { - button_info *btn = &m_buttons[id]; btn->guibutton = m_guienv->addButton(button_rect, nullptr, id, caption.c_str()); btn->guibutton->grab(); @@ -191,81 +167,59 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, const rect &button_ btn->immediate_release = immediate_release; btn->ids.clear(); - load_button_texture(btn, id, button_rect, - m_texturesource, m_device->getVideoDriver()); + load_button_texture(btn, button_imagenames[id], button_rect, + m_texturesource, m_device->getVideoDriver()); +} + +button_info *TouchScreenGUI::initJoystickButton(touch_gui_button_id id, + const rect &button_rect, int texture_id, bool visible) +{ + auto *btn = new button_info(); + btn->guibutton = m_guienv->addButton(button_rect, nullptr, id, L"O"); + btn->guibutton->setVisible(visible); + btn->guibutton->grab(); + btn->ids.clear(); + + load_button_texture(btn, joystick_imagenames[texture_id], + button_rect, m_texturesource, m_device->getVideoDriver()); + + return btn; } void TouchScreenGUI::init(ISimpleTextureSource *tsrc) { - assert(tsrc != nullptr); + assert(tsrc); - float density = porting::getDisplayDensity() * g_settings->getFloat("hud_scaling"); - s32 button_size = static_cast(density * 60); - s32 ctlpad_size = static_cast(density * 85); - m_visible = true; - m_texturesource = tsrc; - m_control_pad_rect = rect(0, (m_screensize.Y - ctlpad_size * 3), - (ctlpad_size * 3), m_screensize.Y); + m_visible = true; + m_texturesource = tsrc; - /* - draw control pad - 0 3 6 - 1 4 7 - 2 5 8 - */ + /* Init joystick display "button" + * Joystick is placed on bottom left of screen. + */ + if (m_fixed_joystick) { + m_joystick_btn_off = initJoystickButton(joystick_off_id, + rect(button_size / 2, + m_screensize.Y - button_size * 4.5, + button_size * 4.5, + m_screensize.Y - button_size / 2), 0); + } else { + m_joystick_btn_off = initJoystickButton(joystick_off_id, + rect(button_size / 2, + m_screensize.Y - button_size * 3.5, + button_size * 3.5, + m_screensize.Y - button_size / 2), 0); + } - int number = 0; - for (int y = 0; y < 3; ++y) - for (int x = 0; x < 3; ++x, ++number) { - v2s32 tl; - tl.X = ctlpad_size * y; - tl.Y = m_screensize.Y - ctlpad_size * (3 - x); + m_joystick_btn_bg = initJoystickButton(joystick_bg_id, + rect(button_size / 2, + m_screensize.Y - button_size * 4.5, + button_size * 4.5, + m_screensize.Y - button_size / 2), + 1, false); + + m_joystick_btn_center = initJoystickButton(joystick_center_id, + rect(0, 0, button_size * 1.5, button_size * 1.5), 2, false); - rect button_rect(tl.X, tl.Y, tl.X + ctlpad_size, tl.Y + ctlpad_size); - touch_gui_button_id id = after_last_element_id; - std::wstring caption; - switch (number) { - case 0: - id = forward_one; - caption = L"^"; - break; - case 3: - id = forward_two; - caption = L"^"; - break; - case 6: - id = forward_three; - caption = L"^"; - break; - case 1: - id = left_id; - caption = L"<"; - break; - case 4: - id = empty_id; - break; - case 2: - id = backward_one; - caption = L"v"; - break; - case 5: - id = backward_two; - caption = L"v"; - break; - case 8: - id = backward_three; - caption = L"v"; - break; - case 7: - id = right_id; - caption = L">"; - break; - default: - break; - } - if (id != after_last_element_id) - initButton(id, button_rect, caption, false); - } // init inventory button initButton(inventory_id, @@ -273,7 +227,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.Y - button_size * 1.5, m_screensize.X, m_screensize.Y), - L"inv", false, SLOW_BUTTON_REPEAT); + L"inv", false); // init crunch button initButton(crunch_id, @@ -281,7 +235,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.Y - button_size / 1.5, m_screensize.X - button_size * 1.5, m_screensize.Y), - L"H", false, SLOW_BUTTON_REPEAT); + L"H", false); // init jump button initButton(jump_id, @@ -289,7 +243,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.Y - button_size * 3, m_screensize.X - button_size * 1.5, m_screensize.Y - button_size * 1.5), - L"x", false, SLOW_BUTTON_REPEAT); + L"x", false); // init drop button initButton(drop_id, @@ -297,7 +251,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.Y / 2 - button_size, m_screensize.X, m_screensize.Y / 2), - L"drop", false, SLOW_BUTTON_REPEAT); + L"drop", false); // dirty implementation of positions for iOS #ifndef __IOS__ @@ -316,7 +270,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) 0, m_screensize.X / 2 - button_size / button_05, button_size), - L"Exit", false, SLOW_BUTTON_REPEAT); + L"Exit", false); // init minimap button [2] #ifndef __IOS__ @@ -326,7 +280,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) 0, m_screensize.X / 2, button_size), - L"minimap", false, SLOW_BUTTON_REPEAT); + L"minimap", false); #endif // init rangeselect button [3] @@ -335,15 +289,15 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) 0, m_screensize.X / 2 + button_size / button_05, button_size), - L"far", false, SLOW_BUTTON_REPEAT); + L"rangeview", false); // init camera button [4] initButton(camera_id, rect(m_screensize.X / 2 + button_size / button_05, - 0, - m_screensize.X / 2 + button_size * 2 * button_075, - button_size), - L"cam", false, SLOW_BUTTON_REPEAT); + 0, + m_screensize.X / 2 + button_size * 2 * button_075, + button_size), + L"camera", false); // init chat button initButton(chat_id, @@ -351,7 +305,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) 0, m_screensize.X, button_size), - L"far", false, SLOW_BUTTON_REPEAT); + L"Chat", false); // init noclip button /* initButton(noclip_id, @@ -359,14 +313,14 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.Y - button_size * 4.75, m_screensize.X, m_screensize.Y - button_size * 4), - L"clip", false, SLOW_BUTTON_REPEAT); + L"clip", false); // init fast button initButton(fast_id, rect(m_screensize.X - button_size * 0.75, m_screensize.Y - button_size * 4, m_screensize.X, m_screensize.Y - button_size * 3.25), - L"fast", false, SLOW_BUTTON_REPEAT); */ + L"fast", false); */ } touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y) @@ -377,13 +331,12 @@ touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y) gui::IGUIElement *element = rootguielement->getElementFromPoint(core::position2d(x, y)); - if (element) { - for (unsigned int i = 0; i < after_last_element_id; i++) { + if (element) + for (unsigned int i = 0; i < after_last_element_id; i++) if (element == m_buttons[i].guibutton) return (touch_gui_button_id) i; - } - } } + return after_last_element_id; } @@ -404,13 +357,13 @@ touch_gui_button_id TouchScreenGUI::getButtonID(size_t eventID) bool TouchScreenGUI::isHUDButton(const SEvent &event) { // check if hud item is pressed - for (auto & m_hud_rect : m_hud_rects) { - if (m_hud_rect.second.isPointInside(v2s32(event.TouchInput.X, + for (auto &hud_rect : m_hud_rects) { + if (hud_rect.second.isPointInside(v2s32(event.TouchInput.X, event.TouchInput.Y))) { auto *translated = new SEvent(); memset(translated, 0, sizeof(SEvent)); translated->EventType = irr::EET_KEY_INPUT_EVENT; - translated->KeyInput.Key = (irr::EKEY_CODE) (KEY_KEY_1 + m_hud_rect.first); + translated->KeyInput.Key = (irr::EKEY_CODE) (KEY_KEY_1 + hud_rect.first); translated->KeyInput.Control = false; translated->KeyInput.Shift = false; translated->KeyInput.PressedDown = true; @@ -424,7 +377,7 @@ bool TouchScreenGUI::isHUDButton(const SEvent &event) } void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button, - size_t eventID, bool action) + size_t eventID, bool action) { button_info *btn = &m_buttons[button]; auto *translated = new SEvent(); @@ -441,18 +394,16 @@ void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button, btn->ids.push_back(eventID); - if (btn->ids.size() > 1) - return; + if (btn->ids.size() > 1) return; btn->repeatcounter = 0; - m_buttons[button].guibutton->setPressed(true); translated->KeyInput.PressedDown = true; translated->KeyInput.Key = btn->keycode; m_receiver->OnEvent(*translated); } // remove event - if (!action || btn->immediate_release) { + if ((!action) || (btn->immediate_release)) { auto pos = std::find(btn->ids.begin(), btn->ids.end(), eventID); // has to be in touch list assert(pos != btn->ids.end()); @@ -461,7 +412,6 @@ void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button, if (!btn->ids.empty()) return; - m_buttons[button].guibutton->setPressed(false); translated->KeyInput.PressedDown = false; btn->repeatcounter = -1; m_receiver->OnEvent(*translated); @@ -473,12 +423,11 @@ void TouchScreenGUI::handleReleaseEvent(size_t evt_id) { touch_gui_button_id button = getButtonID(evt_id); - // handle button events - if (button != after_last_element_id) + if (button != after_last_element_id) { + // handle button events handleButtonEvent(button, evt_id, false); - - // handle the point used for moving view - if (evt_id == m_move_id) { + } else if (evt_id == m_move_id) { + // handle the point used for moving view m_move_id = -1; // if this pointer issued a mouse event issue symmetric release here @@ -515,6 +464,24 @@ void TouchScreenGUI::handleReleaseEvent(size_t evt_id) } } + // handle joystick + else if (evt_id == m_joystick_id) { + m_joystick_id = -1; + + // reset joystick + for (unsigned int i = 0; i < 4; i++) + m_joystick_status[i] = false; + applyJoystickStatus(); + + m_joystick_btn_off->guibutton->setVisible(true); + m_joystick_btn_bg->guibutton->setVisible(false); + m_joystick_btn_center->guibutton->setVisible(false); + } else { + infostream + << "TouchScreenGUI::translateEvent released unknown button: " + << evt_id << std::endl; + } + for (auto iter = m_known_ids.begin(); iter != m_known_ids.end(); ++iter) { if (iter->id == evt_id) { @@ -524,19 +491,12 @@ void TouchScreenGUI::handleReleaseEvent(size_t evt_id) } } -void TouchScreenGUI::handleReleaseAll() -{ - m_known_ids.clear(); - if (m_move_id != -1) - handleReleaseEvent(m_move_id); - for (auto & m_button : m_buttons) - m_button.ids.clear(); -} - void TouchScreenGUI::translateEvent(const SEvent &event) { if (!m_visible) { - infostream << "TouchScreenGUI::translateEvent got event but not visible?!" << std::endl; + infostream + << "TouchScreenGUI::translateEvent got event but not visible!" + << std::endl; return; } @@ -544,9 +504,11 @@ void TouchScreenGUI::translateEvent(const SEvent &event) return; if (event.TouchInput.Event == ETIE_PRESSED_DOWN) { - /* add to own copy of eventlist... - * android would provide this information but irrlicht guys don't - * wanna design a efficient interface */ + /* + * Add to own copy of event list... + * android would provide this information but Irrlicht guys don't + * wanna design a efficient interface + */ id_status toadd{}; toadd.id = event.TouchInput.ID; toadd.X = event.TouchInput.X; @@ -561,47 +523,61 @@ void TouchScreenGUI::translateEvent(const SEvent &event) // handle button events if (button != after_last_element_id) { handleButtonEvent(button, eventID, true); - // ignore events inside the control pad and HUD if not already handled - } else if (!(m_control_pad_rect.isPointInside(v2s32(toadd.X, toadd.Y)) || isHUDButton(event))) { + } else if (isHUDButton(event)) { + // already handled in isHUDButton() + } else { // handle non button events - // if we don't already have a moving point make this the moving one - if (m_move_id == -1) { - m_move_id = event.TouchInput.ID; - m_move_has_really_moved = false; - m_move_downtime = porting::getTimeMs(); - m_move_downlocation = v2s32(event.TouchInput.X, event.TouchInput.Y); - m_move_sent_as_mouse_event = false; + s32 dxj = event.TouchInput.X - button_size * 5.0f / 2.0f; + s32 dyj = event.TouchInput.Y - m_screensize.Y + button_size * 5.0f / 2.0f; - // update shootline (in case the game handles the event we send below) - m_shootline = m_device - ->getSceneManager() - ->getSceneCollisionManager() - ->getRayFromScreenCoordinates(m_move_downlocation); + /* Select joystick when left 1/3 of screen dragged or + * when joystick tapped (fixed joystick position) + */ + if ((m_fixed_joystick && dxj * dxj + dyj * dyj <= button_size * button_size * 1.5 * 1.5) || + (!m_fixed_joystick && event.TouchInput.X < m_screensize.X / 3.0f)) { + // If we don't already have a starting point for joystick make this the one. + if (m_joystick_id == -1) { + m_joystick_id = event.TouchInput.ID; + m_joystick_has_really_moved = false; - // send a middle click event so the game can handle single touches - auto *translated = new SEvent; - memset(translated, 0, sizeof(SEvent)); - translated->EventType = EET_MOUSE_INPUT_EVENT; - translated->MouseInput.X = m_move_downlocation.X; - translated->MouseInput.Y = m_move_downlocation.Y; - translated->MouseInput.ButtonStates = EMBSM_MIDDLE; // << important! - translated->MouseInput.Event = EMIE_MMOUSE_LEFT_UP; - m_receiver->OnEvent(*translated); - delete translated; + m_joystick_btn_off->guibutton->setVisible(false); + m_joystick_btn_bg->guibutton->setVisible(true); + m_joystick_btn_center->guibutton->setVisible(true); + + // If it's a fixed joystick, don't move the joystick "button". + if (!m_fixed_joystick) + m_joystick_btn_bg->guibutton->setRelativePosition(v2s32( + event.TouchInput.X - button_size * 3.0f / 1.5f, + event.TouchInput.Y - button_size * 3.0f / 1.5f)); + + m_joystick_btn_center->guibutton->setRelativePosition(v2s32( + event.TouchInput.X - button_size / 2.0f * 1.5f, + event.TouchInput.Y - button_size / 2.0f * 1.5f)); + } + } else { + // If we don't already have a moving point make this the moving one. + if (m_move_id == -1) { + m_move_id = event.TouchInput.ID; + m_move_has_really_moved = false; + m_move_downtime = porting::getTimeMs(); + m_move_downlocation = v2s32(event.TouchInput.X, event.TouchInput.Y); + m_move_sent_as_mouse_event = false; + } } } m_pointerpos[event.TouchInput.ID] = v2s32(event.TouchInput.X, event.TouchInput.Y); - } else if (event.TouchInput.Event == ETIE_LEFT_UP) { - verbosestream << "Up event for pointerid: " << event.TouchInput.ID << std::endl; + } + else if (event.TouchInput.Event == ETIE_LEFT_UP) { + verbosestream + << "Up event for pointerid: " << event.TouchInput.ID << std::endl; handleReleaseEvent(event.TouchInput.ID); } else { assert(event.TouchInput.Event == ETIE_MOVED); if (m_pointerpos[event.TouchInput.ID] == - v2s32(event.TouchInput.X, event.TouchInput.Y)) { + v2s32(event.TouchInput.X, event.TouchInput.Y)) return; - } if (m_move_id != -1) { if ((event.TouchInput.ID == m_move_id) && @@ -613,8 +589,8 @@ void TouchScreenGUI::translateEvent(const SEvent &event) (m_pointerpos[event.TouchInput.ID].Y - event.TouchInput.Y) * (m_pointerpos[event.TouchInput.ID].Y - event.TouchInput.Y)); - if (distance > m_touchscreen_threshold || - (m_move_has_really_moved)) { + if ((distance > m_touchscreen_threshold) || + (m_move_has_really_moved)) { m_move_has_really_moved = true; s32 X = event.TouchInput.X; s32 Y = event.TouchInput.Y; @@ -644,9 +620,90 @@ void TouchScreenGUI::translateEvent(const SEvent &event) ->getRayFromScreenCoordinates( v2s32(event.TouchInput.X, event.TouchInput.Y)); } - } else { - handleChangedButton(event); } + + if (m_joystick_id != -1 && event.TouchInput.ID == m_joystick_id) { + s32 X = event.TouchInput.X; + s32 Y = event.TouchInput.Y; + + s32 dx = X - m_pointerpos[event.TouchInput.ID].X; + s32 dy = Y - m_pointerpos[event.TouchInput.ID].Y; + if (m_fixed_joystick) { + dx = X - button_size * 5 / 2; + dy = Y - m_screensize.Y + button_size * 5 / 2; + } + + double distance_sq = dx * dx + dy * dy; + + s32 dxj = event.TouchInput.X - button_size * 5.0f / 2.0f; + s32 dyj = event.TouchInput.Y - m_screensize.Y + button_size * 5.0f / 2.0f; + bool inside_joystick = (dxj * dxj + dyj * dyj <= button_size * button_size * 1.5 * 1.5); + + if (m_joystick_has_really_moved || + (!m_joystick_has_really_moved && inside_joystick) || + (!m_fixed_joystick && + distance_sq > m_touchscreen_threshold * m_touchscreen_threshold)) { + m_joystick_has_really_moved = true; + double distance = sqrt(distance_sq); + + // angle in degrees + double angle = acos(dx / distance) * 180 / M_PI; + if (dy < 0) + angle *= -1; + // rotate to make comparing easier + angle = fmod(angle + 180 + 22.5, 360); + + // reset state before applying + for (bool & joystick_status : m_joystick_status) + joystick_status = false; + + if (distance <= m_touchscreen_threshold) { + // do nothing + } else if (angle < 45) + m_joystick_status[j_left] = true; + else if (angle < 90) { + m_joystick_status[j_forward] = true; + m_joystick_status[j_left] = true; + } else if (angle < 135) + m_joystick_status[j_forward] = true; + else if (angle < 180) { + m_joystick_status[j_forward] = true; + m_joystick_status[j_right] = true; + } else if (angle < 225) + m_joystick_status[j_right] = true; + else if (angle < 270) { + m_joystick_status[j_backward] = true; + m_joystick_status[j_right] = true; + } else if (angle < 315) + m_joystick_status[j_backward] = true; + else if (angle <= 360) { + m_joystick_status[j_backward] = true; + m_joystick_status[j_left] = true; + } + + if (distance > button_size * 1.5) { + m_joystick_status[j_special1] = true; + // move joystick "button" + s32 ndx = button_size * dx / distance * 1.5f - button_size / 2.0f * 1.5f; + s32 ndy = button_size * dy / distance * 1.5f - button_size / 2.0f * 1.5f; + if (m_fixed_joystick) { + m_joystick_btn_center->guibutton->setRelativePosition(v2s32( + button_size * 5 / 2 + ndx, + m_screensize.Y - button_size * 5 / 2 + ndy)); + } else { + m_joystick_btn_center->guibutton->setRelativePosition(v2s32( + m_pointerpos[event.TouchInput.ID].X + ndx, + m_pointerpos[event.TouchInput.ID].Y + ndy)); + } + } else { + m_joystick_btn_center->guibutton->setRelativePosition( + v2s32(X - button_size / 2 * 1.5, Y - button_size / 2 * 1.5)); + } + } + } + + if (m_move_id == -1 && m_joystick_id == -1) + handleChangedButton(event); } } @@ -686,7 +743,7 @@ void TouchScreenGUI::handleChangedButton(const SEvent &event) if (std::find(btn->ids.begin(), btn->ids.end(), event.TouchInput.ID) == btn->ids.end()) handleButtonEvent((touch_gui_button_id) current_button_id, - event.TouchInput.ID, true); + event.TouchInput.ID, true); } // Punch or left click @@ -716,45 +773,81 @@ bool TouchScreenGUI::quickTapDetection() ->getSceneCollisionManager() ->getRayFromScreenCoordinates(v2s32(m_key_events[0].x, m_key_events[0].y)); - translated->MouseInput.Event = EMIE_RMOUSE_PRESSED_DOWN; + translated->MouseInput.Event = EMIE_RMOUSE_PRESSED_DOWN; verbosestream << "TouchScreenGUI::translateEvent right click press" << std::endl; m_receiver->OnEvent(*translated); translated->MouseInput.ButtonStates = 0; - translated->MouseInput.Event = EMIE_RMOUSE_LEFT_UP; + translated->MouseInput.Event = EMIE_RMOUSE_LEFT_UP; verbosestream << "TouchScreenGUI::translateEvent right click release" << std::endl; m_receiver->OnEvent(*translated); delete translated; return true; } -TouchScreenGUI::~TouchScreenGUI() { - for (auto & m_button : m_buttons) { - button_info *btn = &m_button; - if (btn->guibutton) { - btn->guibutton->drop(); - btn->guibutton = nullptr; +void TouchScreenGUI::applyJoystickStatus() +{ + for (unsigned int i = 0; i < 5; i++) { + if (i == 4) + continue; + + SEvent translated{}; + translated.EventType = irr::EET_KEY_INPUT_EVENT; + translated.KeyInput.Key = id2keycode(m_joystick_names[i]); + translated.KeyInput.PressedDown = false; + m_receiver->OnEvent(translated); + + if (m_joystick_status[i]) { + translated.KeyInput.PressedDown = true; + m_receiver->OnEvent(translated); } } } +TouchScreenGUI::~TouchScreenGUI() +{ + for (auto &button : m_buttons) { + if (button.guibutton) { + button.guibutton->drop(); + button.guibutton = nullptr; + } + } + + if (m_joystick_btn_off->guibutton) { + m_joystick_btn_off->guibutton->drop(); + m_joystick_btn_off->guibutton = nullptr; + } + + if (m_joystick_btn_bg->guibutton) { + m_joystick_btn_bg->guibutton->drop(); + m_joystick_btn_bg->guibutton = nullptr; + } + + if (m_joystick_btn_center->guibutton) { + m_joystick_btn_center->guibutton->drop(); + m_joystick_btn_center->guibutton = nullptr; + } +} + void TouchScreenGUI::step(float dtime) { // simulate keyboard repeats - for (auto & m_button : m_buttons) { - button_info *btn = &m_button; + for (auto &button : m_buttons) { + if (!button.ids.empty()) { + button.repeatcounter += dtime; - if (!btn->ids.empty()) { - btn->repeatcounter += dtime; + // in case we're moving around digging does not happen + if (m_move_id != -1) + m_move_has_really_moved = true; - if (btn->repeatcounter < btn->repeatdelay) + if (button.repeatcounter < button.repeatdelay) continue; - btn->repeatcounter = 0; - SEvent translated{}; + button.repeatcounter = 0; + SEvent translated; memset(&translated, 0, sizeof(SEvent)); translated.EventType = irr::EET_KEY_INPUT_EVENT; - translated.KeyInput.Key = btn->keycode; + translated.KeyInput.Key = button.keycode; translated.KeyInput.PressedDown = false; m_receiver->OnEvent(translated); @@ -763,20 +856,28 @@ void TouchScreenGUI::step(float dtime) } } + // joystick + for (unsigned int i = 0; i < 4; i++) { + if (m_joystick_status[i]) { + applyJoystickStatus(); + break; + } + } + // if a new placed pointer isn't moved for some time start digging if ((m_move_id != -1) && (!m_move_has_really_moved) && (!m_move_sent_as_mouse_event)) { u64 delta = porting::getDeltaMs(m_move_downtime, porting::getTimeMs()); - if (delta > MIN_DIG_TIME) { + if (delta > MIN_DIG_TIME_MS) { m_shootline = m_device ->getSceneManager() ->getSceneCollisionManager() ->getRayFromScreenCoordinates( v2s32(m_move_downlocation.X, m_move_downlocation.Y)); - SEvent translated{}; + SEvent translated; memset(&translated, 0, sizeof(SEvent)); translated.EventType = EET_MOUSE_INPUT_EVENT; translated.MouseInput.X = m_move_downlocation.X; @@ -805,11 +906,14 @@ void TouchScreenGUI::registerHudItem(int index, const rect &rect) void TouchScreenGUI::Toggle(bool visible) { m_visible = visible; - for (auto & m_button : m_buttons) { - if (m_button.guibutton) - m_button.guibutton->setVisible(visible); + for (auto &button : m_buttons) { + if (button.guibutton) + button.guibutton->setVisible(visible); } + if (m_joystick_btn_off->guibutton) + m_joystick_btn_off->guibutton->setVisible(visible); + // clear all active buttons if (!visible) { while (!m_known_ids.empty()) @@ -832,3 +936,12 @@ void TouchScreenGUI::show() Toggle(true); } + +void TouchScreenGUI::handleReleaseAll() +{ + m_known_ids.clear(); + if (m_move_id != -1) + handleReleaseEvent(m_move_id); + for (auto &button : m_buttons) + button.ids.clear(); +} diff --git a/src/touchscreengui.h b/src/touchscreengui.h index 844f4890..b489e8f7 100644 --- a/src/touchscreengui.h +++ b/src/touchscreengui.h @@ -35,15 +35,6 @@ using namespace irr::gui; typedef enum { - forward_one, - forward_two, - forward_three, - backward_one, - backward_two, - backward_three, - left_id, - right_id, - empty_id, inventory_id, drop_id, jump_id, @@ -55,28 +46,46 @@ typedef enum chat_id, // noclip_id, // fast_id, - after_last_element_id + after_last_element_id, + forward_id, + backward_id, + left_id, + right_id, + joystick_off_id, + joystick_bg_id, + joystick_center_id } touch_gui_button_id; -#define MIN_DIG_TIME 500 +typedef enum +{ + j_forward = 0, + j_backward, + j_left, + j_right, + j_special1 +} touch_gui_joystick_move_id; + +#define MIN_DIG_TIME_MS 500 #define BUTTON_REPEAT_DELAY 0.2f -#define SLOW_BUTTON_REPEAT 1.0f +#define SLOW_BUTTON_REPEAT 1.0f + +extern const char **button_imagenames; +extern const char **joystick_imagenames; struct button_info { - float repeatcounter; - float repeatdelay; - irr::EKEY_CODE keycode; + float repeatcounter; + float repeatdelay; + irr::EKEY_CODE keycode; std::vector ids; - IGUIButton *guibutton = NULL; - bool immediate_release; + IGUIButton *guibutton = nullptr; + bool immediate_release; }; class TouchScreenGUI { public: TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver); - ~TouchScreenGUI(); void translateEvent(const SEvent &event); @@ -92,56 +101,70 @@ public: double getPitch() { return m_camera_pitch; } - /* Returns a line which describes what the player is pointing at. + /* + * Returns a line which describes what the player is pointing at. * The starting point and looking direction are significant, * the line should be scaled to match its length to the actual distance * the player can reach. * The line starts at the camera and ends on the camera's far plane. - * The coordinates do not contain the camera offset. */ + * The coordinates do not contain the camera offset. + */ line3d getShootline() { return m_shootline; } void step(float dtime); - void resetHud(); - void registerHudItem(int index, const rect &rect); - void Toggle(bool visible); void hide(); - void show(); + // handle all buttons void handleReleaseAll(); private: - IrrlichtDevice *m_device; - IGUIEnvironment *m_guienv; - IEventReceiver *m_receiver; - ISimpleTextureSource *m_texturesource; + IrrlichtDevice *m_device; + IGUIEnvironment *m_guienv; + IEventReceiver *m_receiver; + ISimpleTextureSource *m_texturesource; v2u32 m_screensize; + s32 button_size; double m_touchscreen_threshold; - std::map > m_hud_rects; + std::map> m_hud_rects; std::map m_hud_ids; - bool m_visible; // is the gui visible + bool m_visible; // is the gui visible // value in degree - double m_camera_yaw_change; - double m_camera_pitch; + double m_camera_yaw_change = 0.0; + double m_camera_pitch = 0.0; - /* A line starting at the camera and pointing towards the + // forward, backward, left, right + touch_gui_button_id m_joystick_names[5] = { + forward_id, backward_id, left_id, right_id}; + bool m_joystick_status[5] = {false, false, false, false}; + + /* + * A line starting at the camera and pointing towards the * selected object. * The line ends on the camera's far plane. - * The coordinates do not contain the camera offset. */ + * The coordinates do not contain the camera offset. + */ line3d m_shootline; rect m_control_pad_rect; - size_t m_move_id; - bool m_move_has_really_moved; - u64 m_move_downtime; - bool m_move_sent_as_mouse_event; - v2s32 m_move_downlocation; + size_t m_move_id = -1; + bool m_move_has_really_moved = false; + u64 m_move_downtime = 0; + bool m_move_sent_as_mouse_event = false; + v2s32 m_move_downlocation = v2s32(-10000, -10000); + + size_t m_joystick_id = -1; + bool m_joystick_has_really_moved = false; + bool m_fixed_joystick = true; + button_info *m_joystick_btn_off = nullptr; + button_info *m_joystick_btn_bg = nullptr; + button_info *m_joystick_btn_center = nullptr; button_info m_buttons[after_last_element_id]; @@ -156,8 +179,13 @@ private: // initialize a button void initButton(touch_gui_button_id id, const rect &button_rect, - const std::wstring &caption, bool immediate_release, - float repeat_delay = BUTTON_REPEAT_DELAY); + const std::wstring &caption, bool immediate_release, + float repeat_delay = SLOW_BUTTON_REPEAT); + + // initialize a joystick button + button_info *initJoystickButton(touch_gui_button_id id, + const rect &button_rect, int texture_id, + bool visible = true); struct id_status { @@ -175,12 +203,15 @@ private: // handle pressed hud buttons bool isHUDButton(const SEvent &event); - // handle quick touch + // handle quick taps bool quickTapDetection(); // handle release event void handleReleaseEvent(size_t evt_id); + // apply joystick status + void applyJoystickStatus(); + // long-click detection variables struct key_event { diff --git a/textures/base/down_one_btn.png b/textures/base/down_one_btn.png deleted file mode 100644 index 1c7fefb6caac2186e53e1e671d778bf9a36916fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e=>VS)S9vhdHP!;s)z#IuwzfcW z`SRsJvebav9jJ_>B*-tA;mqdEn`fRmQ~&$GWT4n`PZ!6KinzO%19=Y{2ryp=FklVl zXbsY64UlL(c+aypEw{7eYwfl9A1BY5pDj4y#l+;cBR|jDGV}-@tw~~$%aC~TRMqAK z+ke)C#%)Zy64ZGX^twtUXeTtV<+U;^C^+6>n0ca+W&0t<)fUz7*&>dVda=!Tw48TZ z^WGV2dB2PJ8)GkCiCxvX diff --git a/textures/base/down_one_press.png b/textures/base/down_one_press.png deleted file mode 100755 index 7315a13ab4b237616c166bc9df8075df47825111..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 627 zcmV-(0*w8MP)pFa&~ZHVq$A+YkPlrgNA`~b8}QwR7FKaJUl#UX=#;}m64H= za&mH}rly*jnms)|tgNiX#l`!BP}cwe04j7+PE!EPv$M0hy3wPitFyPc%)P$V(Wt<> z|I^0V+sVw`z`eT0zP-uDz?sS0-LZlz0004cNklJT5CzZ||-df3IH|{2xAcK%+3Hd?doF%0d@co zfVl|*+h{rkE`%{yMFRlf0EF<2ZO~YB2yko_3;_@T_N{_61vFB246uqdJpcfKLlD9U z4bq}hfNKeV0|LMiAdED!3g9my0Khgj0Si1;0JxTbK1CchkyscRR{=|4vCEy%$Yr?Ba z0QblOXk39n_+a3%5>OCrd<}E&khUuWEzu&4d#{ny2THjU5h0p{o-Z5u8NXbBboo^2bjL;$XlV1}8IN0th34e}>2 zH1lG)K#Pp5{sdS)0LR$y=|2K+>9a5U#lSdl2EeMg0XBevItGjy002}h9#BQucv=7e N002ovPDHLkV1nbv|2zNy diff --git a/textures/base/down_three_btn.png b/textures/base/down_three_btn.png deleted file mode 100644 index 4c04d6e1559bd15a9dff7b9e3a1fc6c0a311fed2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|ei2$DvS9y7PTU%QoscWoNU0n@i z07)RIxVrZ`Pz`%YkY6yv%*~rOpE<*-k?|QQw9M1RF{C2y>3K(976l%cK%E3e?qo*p ztqrYP_j@}Vc^+=8zqfPWe37XCx!+T#~VNFY9ss+ld<@Gxs$#ojsZ;5X39R zvF;qx?q;^89hMyH)_pmyU|Gu(U%`Lq-gB96&mF$a<*^rJnH{@ivBKTxiGEEi{@UA` z7wr17@$-TB6vtATkmm>QRw`KYuKIi+XL(~$nv~48%L|P7wLSw0uJ~sA8{*50=i7%U SFI5A&n8DN4&t;ucLK6Vvsc9?# diff --git a/textures/base/down_three_press.png b/textures/base/down_three_press.png deleted file mode 100755 index 8048d88b0d525ef8dec021f710b62825049ae67e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 639 zcmV-_0)YLAP)|f9T00EClL_t(|UhUS&a)U4sMNu;kb_nt;Cx9Wb{r`WMerli{ zZ6oAO?*5%BN-AKrS_MH_M$z$@BTUcXTrtI$+c@1{QkGzS3$3|H5u({{Vt z?f0pb%-sQH83Y9-$R~BAlseBPCJ?zP%P@8WL=gZc(B<+$X&uLr6(D7*DVG30#Dp|W zOKGYcdq!eY*J0`kND=@Oalf}?I1@XqdF~cSQ+^1Z_a@9a8$iQ=p?jcdFz5J4rQh=f z0BRU;eA65SR(cF`_dwTa-BLW~zNlxQr7(97WLaIuF#uG|eN#fTrl!H%HIU~@0RX{Q zS^`lNJZAtC_rUEIQ@Bi=P4xXVUk*@;t}`WobiMKwm$_>o4Ab;{7QiO@9t6T*31G7k zKnR(m#{+Z!KtIOMzc@e%fULPEK!}!-`SL)L2*7hBbH9Mr^7_Es7cgBVOeF z&tZ(YF93v6F=c(gy#ZmE=L}%XbDuy+G0=4~_7Bvx{66{zstP|DV)_Ou3exKUC@%*7 Zfgd_$?QONV80Y{1002ovPDHLkV1h^16~O=i diff --git a/textures/base/down_two_btn.png b/textures/base/down_two_btn.png deleted file mode 100644 index 62163d20ac55b6940f41dfd42c939e5e4f0bd9f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e(Ey(iS6f?Kd3kwVV=W-LeEIU~ z>S`b(por@sPyu^MkYDi3Gn+S`+05Yfm~A>xsMXWOF{Fa=?I}aSBL+OIfx!`6ixRjN z3UEE+e`vD!nR(a$o^J1nx!-%&uit*ukYgT)ghB?V0N;r#FV4yYEbQ1NC*digxcQ%) z$i))r1+UgIE?afsdDCktU#5Sz=Cmi=`>wd6mSK;Q*>#4<^22P4p3G!;qv%0zf@Tkgg0004Y zNkl>U=)q2ZfB*gWGkQf|30Rhm zEbFTP$FXe}*|y_+B;a}H=DzQ`0dig6XF?tbLl4c(qbLX#C!xYjvh2_bb*My5Q`c2x&IJGi8Rlp`v_bm277<~NWdM%m3~a_2AcChdz;?^u?{*2& zZy^IfDN4|8CkyP6IVXTxj!hpaCgcDvjuUhffZ|vlIR607KZq?70x-W5K-=vB$pCSz zffQW@kOq!N+R6YtzXf1I1_(o?Fh@K;10V*7P$~>1fawr9`v7Jh#B{hw07^~3)Ovjm z&UINgSW8Kgk&<&MidL;#z h>C3uV*Y!psz#DaiqCGseEj<7L002ovPDHLkV1im|{$v0E diff --git a/textures/base/empty_btn.png b/textures/base/empty_btn.png deleted file mode 100755 index fe674fb699d22545f2384f36d881608e97737676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0L3?#3!&-4XSJOMr-uC}(ey2e`a^724|Q_t5o z11Xl0Aiv<5o6j&@?h)7zn>T75&iEF zU&6e@41Xk*BiOE)8}IsMy2!!& z0@3x2Ij%RXx3FsP^B-F1*SkY?P7}v+r$d@E3-T1^EarIbb;xpd!Ak~)wt^|fs-=^~ QfbL-MboFyt=akR{0Ntod_W%F@ diff --git a/textures/base/joystick_bg.png b/textures/base/joystick_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..274f722007415fd0382f49e31cadcc97c0bce93d GIT binary patch literal 814 zcmV+}1JV46P){2$rP1&lrO_|uX0sGbNAX-lhN=m9zX z6XPESoWuix9#C5^Fz5kb9}eUIX+8*2z}Eaq+ei=t;ItjvK@bBV$4_^i&0r~@S|9`@|xD!EB0QPHN z6c~EI=l!)D$^~iwk$>&0FJgBE6989&u4xOm4MP$&|k~1VM{>tw=D#6 zfT|yY0muQWeh3C22dMfX7=Rq0>W82qU=^(&08;>rn*nGIDCjRI2wech@1Q%7pFu0Y z+CFzb2sZ?Tp&=l>gHZj)SPzIkfInBkS^|LhFy(dtfQa7=fW^OkHNa>Az}?MO@frbM zb-OhH8^8c=4N&z%AO{R!00S7n00uCC0SsUO0~o*n1~7p6ghUA#zyN?-1Hj$A2S6YI z+|3Lvc1obL*-vi!0( zfXZhO`FH|qzHv|CS$JU-X z?EoPl!rNx%M86pTxA*q;-vU|!9&Q!_!GS<}z=J9P4>e#;WSUdCJ{JH5eG%YX0JwWW zzXc!*a{YS07vNkF^_spOkPk|Iu9)DYRskRjO8a_176|%UKnN}pAm^j62NVc!zt-0S z9*_l}oQ&XC4$s#EvLFcleAZl`pa+CNaEXQ-5DS6mCYK_>+~zYkI?b(KbF1I=``rHjA9P!Ghi;V$YybcN07*qoM6N<$f}3YmUH||9 literal 0 HcmV?d00001 diff --git a/textures/base/joystick_center.png b/textures/base/joystick_center.png new file mode 100644 index 0000000000000000000000000000000000000000..9562687585cd5712d15fb149b85f4b963667e3db GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|exd5LK*Z=?jFJ8QO^5n_8cJ0c| z&HeNDe|dR%LqkJnXJ>3|EYGJLZ=g!Xk|4ie28U-i(tw;Do-U3d6^w6BIZixcz~gdp zp#s+;AQIqObV0;LF{k{J=R`xWzMsQmQsL_cmhd}T6~CD!zeU@8QQ(LH`hmgI)z4*}Q$iB}PIP%? literal 0 HcmV?d00001 diff --git a/textures/base/joystick_off.png b/textures/base/joystick_off.png new file mode 100644 index 0000000000000000000000000000000000000000..bd888d93dbc1a36a23fdad9cd3602f50b057ca9b GIT binary patch literal 1039 zcmV+q1n~QbP)I;s`vDywPxSM~vb0zJU<5k#8V;Z06_r=XbgZG0OF-HkWdT2`580=aC!!M0Q*-H>>xA< zprI}R`vd^qe~k42_5r{i(P32r0Pw?<<^TY|cw+zr{@XhOD3AkEz330|FpS5F1yum{ zdME%)!$84!X8=M8V49|3evX7@0MqyPJTJ?dwk(Oz6kwXZ=VkAcuu*U;K;a1t(>$m4 zwjNvNc`Z7Fdjf{>=V$M8%d&05*brct$Ddcgwyt9X0QQ$VUfR6yMnEDj~9R42~^OA2; z=>d7ZRzUE{vtI+i^9-2h3Fra+yX76we__#oWz&CYKM`Q~(Y>0QU8O{zj($ zR<8F206hA7z_|c`nYr{U08sGJI{T;^a3Wycr>_U(FG_txPVlBy1t1rA_Vs{Vpy=xX z6qFNyJkP!!;2?lmQC|<>fD-}mCcuhcp05X-2uQHU!{-78J%9qiB^q)7M}g=j7bif! z&8Oe!)Nl3bH@o%Q{rU}${g%&u(`&!&x8L~OZ~g8!zxUh!{{UE}y|G?=EL{Kq002ov JPDHLkV1mAS#5@21 literal 0 HcmV?d00001 diff --git a/textures/base/left_btn.png b/textures/base/left_btn.png deleted file mode 100644 index 97f489070b0ab9c757a9735928ac49802300471c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|ep#Yx{S9vhdHP*7VwXLqM2J!+= z%-9Z;Wh)8t3uZX8dFJNLO2_JXfg;78E{-7;jBl@oN**u}V15wU(HddFoxbqj(w>>0 zdllFJJuR}7(Q~zPdBkK>23ZFoqZi*C4sBz2m5|b-*5voI?0_x9n??qOT<#ffAF|uu zV8~Kr=6GN^efkZSH%bb1?9%&GSRGhv1qCi~EO@6prLcYXdR9&Y)s!^8l$Hvh^$eb_ KelF{r5}E)E6-a>q diff --git a/textures/base/left_press.png b/textures/base/left_press.png deleted file mode 100755 index 762a5f43ecb0d0806a591da4647f21a44091c533..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 504 zcmVnv&_}Lz^J3y#;dd2$-TFx-KV9@x~{RVsG_8^7)`Fy0003aNkleZOPp-?{N9F6mV*S{;j{*&p2pU#X0gT3M~mMr#~_xeqhziji@edd7!;{*Id7yH=9 uICv6qy$-|mKLMa{_`YVP<98o>Fz^R>il!|+TIUM@0000gsBFd3jx9Eg%U5 zKrRrZG4;;?s$nk)@(Z51dGqEo3}+s$J(Ua;n(XP~7*Y}U_Uc8>BMJg753>`aW{53o z%{?fV^Y9iwn_lv~O_7ZU1n)oj@8Ec}pWVarcu3HeYeol{R7{&an1v^Z?c#T0>N@af z&uOI%D;TFX9R1JG-NCXWVlh|T2d3{@5&N&6-|zdqG(mPF%ZYoxzpH(a^IYUDD7qn? z;a`9r<6ZU}pD$E0%nOtFdA&G+qg?27py~lO-nYGhlMK`!0-eX;>FVdQ&MBb@02EhZ AQ2+n{ diff --git a/textures/base/right_press.png b/textures/base/right_press.png deleted file mode 100755 index 0c7ad8553b33a9370bfa840789ad061dd69aaeb5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 570 zcmV-A0>%A_P)RzSXfwTX=!+Pcz%9Zo)7WgyGmEg(So-4okw?QYi2Lh8+z; zhsvl|InG7D`}rl-*x4(_SeQ^2nLwTw#TzLE$bh9dk>^vGfntCRS&(sAR#20EU_PIK zfyca}rm4X>@3jL=ki2@#!I6h_0S@V%9Hk3Pr!r3)U;^{HmT~I9Vu3lxR01Kit#+WQ zilPSRp2tfFpdBd7)v9S`Ge?i1U;wlN>-A=H|KPlLF2IsRpsrI0$eh|X(DS&5EvW=J z-|Zf6n*@5H8rbg-hvV^dTEacBrJnQyA0IOBsq6k%VEj*E{BPp;zs5M>y#twxKzf1k z|CPsoGL8RqmgB|W2aE&(`gO=7PiX@2LGu&Nbh~K=WG;v8FSuN;*YnwdhctnVEPPXR z;TRxb?W?&2EEtF`U4sRTi4)Ir1M$UkxPT<$xdj1QT@n(mZ0o(TjT0D;bHzY9K?Qh`UHNVF7Aj_`%Q%xH7YzX&R@cY|W<_WehnS;I+ zG`>rbaF~1JF8h)f(!U(a1W2k7TVsx0w?s9y0SPSEkL!DcJP)se*Ei)=kPEJToMq*-OUSnKVTU2s(a6LUeT3T9bYin?DaA;^~qN1XEe|dz2 zgkoZ1b8~a3sHlU6fpT(kjg5`0tgLBiX_SuUz`n+rquZ;f|H-qa-P_E`x5>u3 z#=yY7y1u==y3EYEBlDnm0004nNklp1i{Zc z2`)HO3y_Oo^+mAVMQ}k61_QMKJlpVHxYHf<|Gcs&V?t;1%iLZd0Z7P*mEnqH!sMa( zFC;{%NKhFTEV$a7ZS6M@F;#-HgaxqT42?HPrD+7G%C-PDJ!Wg`4XS?T;()6GY!Wif zHy9An8Pz$NiZOwVS!gVX_4axIHwh~~0+n(VupL(qD(k5A@(SNEY-?9{*qP7h;HBU}M_B QasU7T07*qoM6N<$f^R4Kjl+yaj|yGFbFf8 z@nJ}4VicCx(V*}tNL;{W#{z{v{w!5$3=_(l8qUm}z~Pap&ak87)5`sv4)#GmL$kAs zAM35SAL9Pnm%;7xc}|x`wuq+2zicde1|B!rSdN2T2`njxg HN@xNAvOHaG diff --git a/textures/base/up_three_press.png b/textures/base/up_three_press.png deleted file mode 100755 index dc5cb793aa160adac43a4b4a19a2410f1bc24fa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 586 zcmV-Q0=4~#P)mPF7n~USnKhVq!f#J#uz%T3T9YXlQV7aBFL8Vq#*1goJy4 zd2@4fjg5_ihJlonlu%Vpa&mHMX=!?TdaSIh#l^+J!NI1crm?ZHkdTl(JUqrEI*|YX z03vi!PE!EPv(eMK)xN;lnZ~22tJ|it$=$ciy1mK9%*or?#>~08TC9020004TNklkN{e28|XfI)nc1~5uG}~POKSl-CqWjl~^wzFEj#^`6RJYAPA1f z;e}=}ofA+M)(gZK9^*+s6ZR`+`M~gLXO0HUCwR2fI)ULf3Pa}l68RddF_0u{1WF`H zRWTRS`Iykp-YNlOD)dUnIH|77)H;Fl`Gm`*Z7=GiuDIRqcLNPz`M~3Gy*@?TKEX;E zn@~07*qoM6N<$f(Z=>A^-pY diff --git a/textures/base/up_two_btn.png b/textures/base/up_two_btn.png deleted file mode 100644 index 4dc7a3f8bc6456443548aa67fd96952097f48a81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e(Ey(iS9y7PTU%QoscWoNU0n@i zEMLAn?9PuZKn3h2L4LsuGdFMEeC7gTe~DWM4fVEa++ diff --git a/textures/base/up_two_press.png b/textures/base/up_two_press.png deleted file mode 100755 index 73308f01be19d90241f1be361026aab7c6bd952c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 575 zcmV-F0>J%=P)Aka$>9J1 z03vi!PE!Ee-Py^^)yC7ny1uu%v$LqHnWNIov!=7BrLM8AsG_9IJr!iM0004INkl_5i}~!&fdDTr&FHG`ANA zOn?fe8=@&714oQN?n0U#@K0PsmtQBS~X3~VPLBWnS` zgVKTZ4GCKZrV!w;NT}mCHu#BTG`l$fctk}~8AS{N$Qm+1KvFvKDxl9NEey~jsILGr zdO#pReIt+w29nB%7|h99EHH@JZh+5&fLMU)1@#{Z8QC4;fddqkPMm@Bd;-jYzyZ*S zik(h0kj?UG-jM*{0RXW0r7G@~6ENYo>|XK$0HMGgJt3*w09lhUftN7g$)-;Me6V*S zq4oLV4*)t706Z(sV@MX8ssJY0YS(}>5&%3}>;M2(O_qGaS51{{Mi&8qAu(%6jy`{1 zfb|4yTmbN;13$S4-~m6l5CHE0%s4Iso{)X?{W9PgJ6r}_{|^2G{sQwX3LZY>KOX=9 N002ovPDHLkV1hL6>}>!5