Make haptics intensity on ios and android the same

This commit is contained in:
sector-a
2025-07-16 16:51:02 +03:00
parent 13c08b285d
commit d8cd580535
4 changed files with 7 additions and 15 deletions
+2 -2
View File
@@ -205,13 +205,13 @@ class Preferences
/**
* Multiplier of intensity for all the haptic feedback effects.
* @default `1`
* @default `2.5`
*/
public static var hapticsIntensityMultiplier(get, set):Float;
static function get_hapticsIntensityMultiplier():Float
{
return Save?.instance?.options?.hapticsIntensityMultiplier ?? 1;
return Save?.instance?.options?.hapticsIntensityMultiplier ?? 2.5;
}
static function set_hapticsIntensityMultiplier(value:Float):Float
+2 -2
View File
@@ -123,7 +123,7 @@ class Save
zoomCamera: true,
debugDisplay: false,
hapticsMode: 'All',
hapticsIntensityMultiplier: 1,
hapticsIntensityMultiplier: 2.5,
autoPause: true,
vsyncMode: 'Off',
strumlineBackgroundOpacity: 0,
@@ -1557,7 +1557,7 @@ typedef SaveDataOptions =
/**
* Multiplier of intensity for all the haptic feedback effects.
* @default `1`
* @default `2.5`
*/
var hapticsIntensityMultiplier:Float;
+1 -1
View File
@@ -137,7 +137,7 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
});
createPrefItemNumber('Haptics Intensity', 'Multiplier of intensity for all the haptic feedback effects.', function(value:Float) {
Preferences.hapticsIntensityMultiplier = value;
}, null, Preferences.hapticsIntensityMultiplier, 0, 2, 0.1, 0);
}, null, Preferences.hapticsIntensityMultiplier, 0, 5, 0.1, 1);
#end
createPrefItemCheckbox('Flashing Lights', 'If disabled, it will dampen flashing effects. Useful for people with photosensitive epilepsy.',
function(value:Bool):Void {
+2 -10
View File
@@ -39,20 +39,12 @@ class HapticUtil
?targetHapticsModes:Array<HapticsMode>):Void
{
#if FEATURE_HAPTICS
if (!HapticUtil.hapticsAvailable || Preferences.hapticsIntensityMultiplier == 0) return;
if (!HapticUtil.hapticsAvailable) return;
final hapticsModes:Array<HapticsMode> = targetHapticsModes ?? [HapticsMode.ALL];
if (!hapticsModes.contains(Preferences.hapticsMode)) return;
#if ios
var amplitudeValue = FlxMath.bound(amplitude * 2.5, 0, Constants.MAX_VIBRATION_AMPLITUDE);
#else
var amplitudeValue = amplitude;
#end
amplitudeValue *= Preferences.hapticsIntensityMultiplier;
if (amplitudeValue > Constants.MAX_VIBRATION_AMPLITUDE) amplitudeValue = Constants.MAX_VIBRATION_AMPLITUDE;
final amplitudeValue = FlxMath.bound(amplitude * Preferences.hapticsIntensityMultiplier, 0, Constants.MAX_VIBRATION_AMPLITUDE);
if (period > 0)
{