Minor TouchScreenGUI fixes
This commit is contained in:
parent
93232becc0
commit
141559689e
@ -92,7 +92,7 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
|
||||
case special1_id:
|
||||
key = "special1";
|
||||
break;
|
||||
case fly_id:
|
||||
/*case fly_id:
|
||||
key = "freemove";
|
||||
break;
|
||||
case noclip_id:
|
||||
@ -106,7 +106,7 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
|
||||
break;
|
||||
case toggle_chat_id:
|
||||
key = "toggle_chat";
|
||||
break;
|
||||
break;*/
|
||||
case minimap_id:
|
||||
key = "minimap";
|
||||
break;
|
||||
@ -433,7 +433,6 @@ TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver)
|
||||
for (auto &button : m_buttons) {
|
||||
button.guibutton = nullptr;
|
||||
button.repeatcounter = -1;
|
||||
button.repeatdelay = BUTTON_REPEAT_DELAY;
|
||||
}
|
||||
|
||||
m_touchscreen_threshold = g_settings->getU16("touchscreen_threshold");
|
||||
@ -482,6 +481,7 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
{
|
||||
assert(tsrc);
|
||||
|
||||
m_visible = true;
|
||||
m_texturesource = tsrc;
|
||||
|
||||
/* Init joystick display "button"
|
||||
@ -637,16 +637,12 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
|
||||
touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y)
|
||||
{
|
||||
IGUIElement *rootguielement = m_guienv->getRootGUIElement();
|
||||
for (u32 i = 0; i < after_last_element_id; i++) {
|
||||
if (!m_buttons[i].guibutton)
|
||||
continue;
|
||||
|
||||
if (rootguielement != nullptr) {
|
||||
gui::IGUIElement *element =
|
||||
rootguielement->getElementFromPoint(core::position2d<s32>(x, y));
|
||||
|
||||
if (element)
|
||||
for (u32 i = 0; i < after_last_element_id; i++)
|
||||
if (element == m_buttons[i].guibutton)
|
||||
return (touch_gui_button_id) i;
|
||||
if (m_buttons[i].guibutton->isPointInside(core::position2d<s32>(x, y)))
|
||||
return (touch_gui_button_id) i;
|
||||
}
|
||||
|
||||
return after_last_element_id;
|
||||
@ -962,14 +958,11 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
|
||||
}
|
||||
|
||||
m_pointerpos[event.TouchInput.ID] = v2s32(event.TouchInput.X, event.TouchInput.Y);
|
||||
}
|
||||
else if (event.TouchInput.Event == ETIE_LEFT_UP) {
|
||||
} 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);
|
||||
|
||||
} else if (event.TouchInput.Event == ETIE_MOVED) {
|
||||
if (m_pointerpos[event.TouchInput.ID] ==
|
||||
v2s32(event.TouchInput.X, event.TouchInput.Y))
|
||||
return;
|
||||
|
@ -51,11 +51,11 @@ typedef enum
|
||||
after_last_element_id,
|
||||
// settings_starter_id,
|
||||
// rare_controls_starter_id,
|
||||
fly_id,
|
||||
noclip_id,
|
||||
fast_id,
|
||||
debug_id,
|
||||
toggle_chat_id,
|
||||
// fly_id,
|
||||
// noclip_id,
|
||||
// fast_id,
|
||||
// debug_id,
|
||||
// toggle_chat_id,
|
||||
forward_id,
|
||||
backward_id,
|
||||
left_id,
|
||||
@ -83,13 +83,10 @@ typedef enum
|
||||
} autohide_button_bar_dir;
|
||||
|
||||
#define MIN_DIG_TIME_MS 500
|
||||
#define BUTTON_REPEAT_DELAY 0.2f
|
||||
#define BUTTON_REPEAT_DELAY 1.0f
|
||||
#define SETTINGS_BAR_Y_OFFSET 5
|
||||
#define RARE_CONTROLS_BAR_Y_OFFSET 5
|
||||
|
||||
// Very slow button repeat frequency
|
||||
#define SLOW_BUTTON_REPEAT 1.0f
|
||||
|
||||
extern const char *button_imagenames[];
|
||||
extern const char *joystick_imagenames[];
|
||||
|
||||
@ -277,7 +274,7 @@ private:
|
||||
// initialize a button
|
||||
void initButton(touch_gui_button_id id, const rect<s32> &button_rect,
|
||||
const std::wstring &caption, bool immediate_release,
|
||||
float repeat_delay = SLOW_BUTTON_REPEAT);
|
||||
float repeat_delay = BUTTON_REPEAT_DELAY);
|
||||
|
||||
// initialize a joystick button
|
||||
button_info *initJoystickButton(touch_gui_button_id id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user