settings->setDefault("TMPFolder","/sdcard/" PROJECT_NAME_C "/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("fixed_virtual_joystick", "false");
+ settings->setDefault("virtual_joystick_triggers_aux", "false");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("max_simultaneous_block_sends_per_client", "3");
settings->setDefault("emergequeue_limit_diskonly", "8");
const char **touchgui_button_imagenames = (const char *[]) {
"jump_btn.png",
"down.png",
- "zoom.png"
+ "zoom.png",
+ "aux_btn.png"
};
const char **touchgui_joystick_imagenames = (const char *[]) {
case zoom_id:
key = "zoom";
break;
+ case special1_id:
+ key = "special1";
+ break;
case fly_id:
key = "freemove";
break;
m_touchscreen_threshold = g_settings->getU16("touchscreen_threshold");
m_fixed_joystick = g_settings->getBool("fixed_virtual_joystick");
+ m_joystick_triggers_special1 = g_settings->getBool("virtual_joystick_triggers_aux");
m_screensize = m_device->getVideoDriver()->getScreenSize();
}
// init zoom button
initButton(zoom_id,
rect<s32>(m_screensize.X - (1.25 * button_size),
- m_screensize.Y - (3 * button_size),
+ m_screensize.Y - (4 * button_size),
m_screensize.X - (0.25 * button_size),
- m_screensize.Y - (2 * button_size)),
+ m_screensize.Y - (3 * button_size)),
L"z", false);
+ // init special1 button
+ if (!m_joystick_triggers_special1)
+ initButton(special1_id,
+ rect<s32>(m_screensize.X - (1.25 * button_size),
+ m_screensize.Y - (2.5 * button_size),
+ m_screensize.X - (0.25 * button_size),
+ m_screensize.Y - (1.5 * button_size)),
+ L"spc1", false);
+
m_settingsbar.init(m_texturesource, "gear_icon.png", settings_starter_id,
v2s32(m_screensize.X - (button_size / 2),
m_screensize.Y - ((SETTINGS_BAR_Y_OFFSET + 1) * button_size)
angle = fmod(angle + 180 + 22.5, 360);
// reset state before applying
- for (unsigned int i = 0; i < 4; i ++)
+ for (unsigned int i = 0; i < 5; i ++)
m_joystick_status[i] = false;
if (distance <= m_touchscreen_threshold) {
m_joystick_status[j_left] = true;
}
- // move joystick "button"
if (distance > button_size) {
+ m_joystick_status[j_special1] = true;
+ // move joystick "button"
s32 ndx = (s32) button_size * dx / distance - (s32) button_size / 2;
s32 ndy = (s32) button_size * dy / distance - (s32) button_size / 2;
if (m_fixed_joystick) {
void TouchScreenGUI::applyJoystickStatus()
{
- for (unsigned int i = 0; i < 4; i ++) {
+ for (unsigned int i = 0; i < 5; i ++) {
+ if (i == 4 && !m_joystick_triggers_special1)
+ continue;
+
SEvent translated{};
translated.EventType = irr::EET_KEY_INPUT_EVENT;
translated.KeyInput.Key = id2keycode(m_joystick_names[i]);
jump_id = 0,
crunch_id,
zoom_id,
+ special1_id,
after_last_element_id,
settings_starter_id,
rare_controls_starter_id,
joystick_center_id
} touch_gui_button_id;
-typedef enum { j_forward = 0, j_backward, j_left, j_right } touch_gui_joystick_move_id;
+typedef enum {
+ j_forward = 0,
+ j_backward,
+ j_left,
+ j_right,
+ j_special1
+} touch_gui_joystick_move_id;
typedef enum {
AHBB_Dir_Top_Bottom,
double m_camera_pitch = 0.0;
// forward, backward, left, right
- touch_gui_button_id m_joystick_names[4] = {
- forward_id, backward_id, left_id, right_id};
- bool m_joystick_status[4] = {false, false, false, false};
+ touch_gui_button_id m_joystick_names[5] = {
+ forward_id, backward_id, left_id, right_id, special1_id};
+ bool m_joystick_status[5] = {false, false, false, false, false};
/*!
* A line starting at the camera and pointing towards the
int m_joystick_id = -1;
bool m_joystick_has_really_moved = false;
bool m_fixed_joystick = false;
+ bool m_joystick_triggers_special1 = false;
button_info *m_joystick_btn_off = nullptr;
button_info *m_joystick_btn_bg = nullptr;
button_info *m_joystick_btn_center = nullptr;