Fixes for portrait mode. Move the haptic feedback setting where it belongs.

This commit is contained in:
Henrik Rydgård 2023-02-02 11:59:56 +01:00
parent 1a035a726a
commit af8e4cd36b
5 changed files with 24 additions and 17 deletions

View file

@ -56,6 +56,8 @@ inline float clamp(float f) {
Tilt GenTilt(bool landscape, float calibrationAngle, float x, float y, float z, bool invertX, bool invertY, float deadzone, float xSensitivity, float ySensitivity) {
if (landscape) {
std::swap(x, y);
} else {
x *= -1.0f;
}
Lin::Vec3 down(x, y, z);

View file

@ -692,13 +692,8 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
#endif
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) {
controlsSettings->Add(new CheckBox(&g_Config.bHapticFeedback, co->T("HapticFeedback", "Haptic Feedback (vibration)")));
Choice *customizeTilt = controlsSettings->Add(new Choice(co->T("Tilt control setup")));
customizeTilt->OnClick.Handle(this, &GameSettingsScreen::OnTiltCustomize);
customizeTilt->SetEnabledFunc([] {
return g_Config.iTiltInputType != 0;
});
} else if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_VR) {
controlsSettings->Add(new CheckBox(&g_Config.bHapticFeedback, co->T("HapticFeedback", "Haptic Feedback (vibration)")));
}
@ -715,10 +710,14 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
CheckBox *floatingAnalog = controlsSettings->Add(new CheckBox(&g_Config.bAutoCenterTouchAnalog, co->T("Auto-centering analog stick")));
floatingAnalog->SetEnabledPtr(&g_Config.bShowTouchControls);
// Hide stick background, usefull when increasing the size
// Hide stick background, useful when increasing the size
CheckBox *hideStickBackground = controlsSettings->Add(new CheckBox(&g_Config.bHideStickBackground, co->T("Hide touch analog stick background circle")));
hideStickBackground->SetEnabledPtr(&g_Config.bShowTouchControls);
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) {
controlsSettings->Add(new CheckBox(&g_Config.bHapticFeedback, co->T("HapticFeedback", "Haptic Feedback (vibration)")));
}
// On non iOS systems, offer to let the user see this button.
// Some Windows touch devices don't have a back button or other button to call up the menu.
if (System_GetPropertyBool(SYSPROP_HAS_BACK_BUTTON)) {

View file

@ -1381,9 +1381,6 @@ void NativeAxis(const AxisInput &axis) {
return;
}
// create the base coordinate tilt system from the calibration data.
float tiltBaseAngleY = g_Config.fTiltBaseAngleY;
// figure out what the current tilt orientation is by checking the axis event
// This is static, since we need to remember where we last were (in terms of orientation)
static float tiltX;
@ -1397,6 +1394,9 @@ void NativeAxis(const AxisInput &axis) {
default: break;
}
// create the base coordinate tilt system from the calibration data.
float tiltBaseAngleY = g_Config.fTiltBaseAngleY;
// Figure out the sensitivity of the tilt. (sensitivity is originally 0 - 100)
// We divide by 50, so that the rest of the 50 units can be used to overshoot the
// target. If you want precise control, you'd keep the sensitivity ~50.

View file

@ -34,11 +34,21 @@ void TiltAnalogSettingsScreen::CreateViews() {
auto co = GetI18NCategory("Controls");
auto di = GetI18NCategory("Dialog");
root_ = new LinearLayout(ORIENT_HORIZONTAL);
bool vertical = UseVerticalLayout();
root_ = new LinearLayout(vertical ? ORIENT_VERTICAL : ORIENT_HORIZONTAL);
root_->SetTag("TiltAnalogSettings");
ScrollView *menuRoot = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(600, FILL_PARENT));
root_->Add(menuRoot);
LinearLayout *settings = new LinearLayoutList(ORIENT_VERTICAL);
if (vertical) {
// Don't need a scrollview, probably..
root_->Add(settings);
} else {
ViewGroup *menuRoot = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(600, FILL_PARENT));
root_->Add(menuRoot);
menuRoot->Add(settings);
}
if (g_Config.iTiltInputType == TILT_ANALOG) {
tilt_ = new JoystickHistoryView(StickHistoryViewType::OTHER, "", new LinearLayoutParams(1.0f));
@ -87,8 +97,6 @@ void TiltAnalogSettingsScreen::CreateViews() {
return g_Config.iTiltInputType != 0;
};
LinearLayout *settings = new LinearLayoutList(ORIENT_VERTICAL);
settings->SetSpacing(0);
@ -121,8 +129,6 @@ void TiltAnalogSettingsScreen::CreateViews() {
settings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivityY, 0, 100, co->T("Tilt Sensitivity along Y axis"), screenManager(), "%"))->SetEnabledFunc(enabledFunc);
settings->Add(new PopupSliderChoiceFloat(&g_Config.fDeadzoneRadius, 0.0, 1.0, co->T("Deadzone radius"), 0.01f, screenManager(), "/ 1.0"))->SetEnabledFunc(enabledFunc);
menuRoot->Add(settings);
settings->Add(new BorderView(BORDER_BOTTOM, BorderStyle::HEADER_FG, 2.0f, new LayoutParams(FILL_PARENT, 40.0f)));
settings->Add(new Choice(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}

@ -1 +1 @@
Subproject commit 6719edebaae03330ee5441d9b28280672edf00d5
Subproject commit 7bd1ec93d4586985ba1ef420b43b5e620f68695e