mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-28 05:31:37 +00:00
add camera swipe extent
This commit is contained in:
parent
1204e5a8f4
commit
661ea42152
3 changed files with 16 additions and 2 deletions
|
|
@ -85,6 +85,7 @@ typedef TouchSettings = {
|
||||||
var rewindButtonSize:Float;
|
var rewindButtonSize:Float;
|
||||||
var buttonJoystickMultiplier:Float;
|
var buttonJoystickMultiplier:Float;
|
||||||
var hideControls:Bool;
|
var hideControls:Bool;
|
||||||
|
var cameraSwipeExtent:Float;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef GamepadSettings = {
|
typedef GamepadSettings = {
|
||||||
|
|
@ -174,7 +175,8 @@ class Settings {
|
||||||
rewindButtonPos: [300, 100],
|
rewindButtonPos: [300, 100],
|
||||||
rewindButtonSize: 60,
|
rewindButtonSize: 60,
|
||||||
buttonJoystickMultiplier: 2.5,
|
buttonJoystickMultiplier: 2.5,
|
||||||
hideControls: false
|
hideControls: false,
|
||||||
|
cameraSwipeExtent: 10.0
|
||||||
}
|
}
|
||||||
|
|
||||||
public static var gamepadSettings:GamepadSettings = {
|
public static var gamepadSettings:GamepadSettings = {
|
||||||
|
|
@ -397,7 +399,13 @@ class Settings {
|
||||||
if (touchSettings.hideControls == null) {
|
if (touchSettings.hideControls == null) {
|
||||||
touchSettings.hideControls = false;
|
touchSettings.hideControls = false;
|
||||||
}
|
}
|
||||||
|
if (touchSettings.cameraSwipeExtent == null) {
|
||||||
|
touchSettings.cameraSwipeExtent = 10.0;
|
||||||
|
}
|
||||||
#end
|
#end
|
||||||
|
if (touchSettings.cameraSwipeExtent == 0) {
|
||||||
|
touchSettings.cameraSwipeExtent = 10.0;
|
||||||
|
}
|
||||||
if (json.gamepad != null) {
|
if (json.gamepad != null) {
|
||||||
gamepadSettings = json.gamepad;
|
gamepadSettings = json.gamepad;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,12 @@ class TouchOptionsGui extends GuiImage {
|
||||||
}, 0.5, 118);
|
}, 0.5, 118);
|
||||||
cameraMultiplier.setCurrentOption(Std.int(Util.clamp((Settings.touchSettings.buttonJoystickMultiplier - 0.5) / 0.5, 0, 6)));
|
cameraMultiplier.setCurrentOption(Std.int(Util.clamp((Settings.touchSettings.buttonJoystickMultiplier - 0.5) / 0.5, 0, 6)));
|
||||||
|
|
||||||
|
var swipeExtent = optionCollection.addOption(1, "Camera Swipe Extent", ["5", "10", "15", "20", "25", "30", "35"], (idx) -> {
|
||||||
|
Settings.touchSettings.cameraSwipeExtent = 5 + (idx * 5);
|
||||||
|
return true;
|
||||||
|
}, 0.5, 118);
|
||||||
|
swipeExtent.setCurrentOption(Std.int(Util.clamp((Settings.touchSettings.cameraSwipeExtent - 5) / 5, 0, 6)));
|
||||||
|
|
||||||
var hideCtrls = optionCollection.addOption(1, "Hide Controls", ["No", "Yes"], (idx) -> {
|
var hideCtrls = optionCollection.addOption(1, "Hide Controls", ["No", "Yes"], (idx) -> {
|
||||||
Settings.touchSettings.hideControls = idx == 1;
|
Settings.touchSettings.hideControls = idx == 1;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class CameraInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyNonlinearScale(value:Float) {
|
function applyNonlinearScale(value:Float) {
|
||||||
var clamped = Util.clamp(value, -10, 10);
|
var clamped = Util.clamp(value, -Settings.touchSettings.cameraSwipeExtent, Settings.touchSettings.cameraSwipeExtent);
|
||||||
return Math.abs(clamped) < 3 ? Math.pow(Math.abs(clamped / 2), 2.7) * (clamped >= 0 ? 1 : -1) : clamped;
|
return Math.abs(clamped) < 3 ? Math.pow(Math.abs(clamped / 2), 2.7) * (clamped >= 0 ? 1 : -1) : clamped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue