Set multitouch device scale depending on actual screen size

This commit is contained in:
Deve 2018-08-25 23:34:53 +02:00
parent 4484bd961a
commit 94400b12d6
2 changed files with 43 additions and 1 deletions

View File

@ -48,6 +48,25 @@ void override_default_params()
UserConfigParams::m_multitouch_enabled = true;
}
// Set multitouch device scale depending on actual screen size
int32_t screen_size = AConfiguration_getScreenSize(global_android_app->config);
switch (screen_size)
{
case ACONFIGURATION_SCREENSIZE_SMALL:
case ACONFIGURATION_SCREENSIZE_NORMAL:
UserConfigParams::m_multitouch_scale = 1.3f;
break;
case ACONFIGURATION_SCREENSIZE_LARGE:
UserConfigParams::m_multitouch_scale = 1.2f;
break;
case ACONFIGURATION_SCREENSIZE_XLARGE:
UserConfigParams::m_multitouch_scale = 1.1f;
break;
default:
break;
}
// Enable screen keyboard
UserConfigParams::m_screen_keyboard = 1;

View File

@ -125,12 +125,35 @@ GUIEngine::EventPropagation MultitouchSettingsDialog::processEvent(
}
else if (eventSource == "restore")
{
UserConfigParams::m_multitouch_scale.revertToDefaults();
UserConfigParams::m_multitouch_deadzone_edge.revertToDefaults();
UserConfigParams::m_multitouch_deadzone_center.revertToDefaults();
UserConfigParams::m_multitouch_mode.revertToDefaults();
UserConfigParams::m_multitouch_inverted.revertToDefaults();
UserConfigParams::m_multitouch_controls.revertToDefaults();
#ifdef ANDROID
int32_t screen_size = AConfiguration_getScreenSize(
global_android_app->config);
switch (screen_size)
{
case ACONFIGURATION_SCREENSIZE_SMALL:
case ACONFIGURATION_SCREENSIZE_NORMAL:
UserConfigParams::m_multitouch_scale = 1.3f;
break;
case ACONFIGURATION_SCREENSIZE_LARGE:
UserConfigParams::m_multitouch_scale = 1.2f;
break;
case ACONFIGURATION_SCREENSIZE_XLARGE:
UserConfigParams::m_multitouch_scale = 1.1f;
break;
default:
UserConfigParams::m_multitouch_scale.revertToDefaults();
break;
}
#else
UserConfigParams::m_multitouch_scale.revertToDefaults();
#endif
updateValues();