change fov mode

This commit is contained in:
RandomityGuy 2023-02-05 19:47:25 +05:30
parent 4bd6aaec43
commit 2121bf000c
3 changed files with 12 additions and 7 deletions

View file

@ -79,7 +79,7 @@ class CameraController extends Object {
this.level = level;
// level.scene.addEventListener(onEvent);
// Sdl.setRelativeMouseMode(true);
level.scene.camera.fovY = Settings.optionsSettings.fov;
level.scene.camera.setFovX(Settings.optionsSettings.fovX, Settings.optionsSettings.screenWidth / Settings.optionsSettings.screenHeight);
lockCursor();
}

View file

@ -33,7 +33,7 @@ typedef OptionsSettings = {
var musicVolume:Float;
var soundVolume:Float;
var vsync:Bool;
var fov:Int;
var fovX:Int;
var frameRateVis:Bool;
var oobInsults:Bool;
var reflectiveMarble:Bool;
@ -95,7 +95,7 @@ class Settings {
shadows: false,
musicVolume: 1,
soundVolume: 0.7,
fov: 60,
fovX: 90,
frameRateVis: true,
oobInsults: true,
reflectiveMarble: true,
@ -300,8 +300,8 @@ class Settings {
}
}
optionsSettings = json.options;
if (optionsSettings.fov == 0 #if js || optionsSettings.fov == null #end)
optionsSettings.fov = 60;
if (optionsSettings.fovX == 0 #if js || optionsSettings.fovX == null #end)
optionsSettings.fovX = 90;
controlsSettings = json.controls;
if (json.touch != null) {
touchSettings = json.touch;
@ -385,6 +385,11 @@ class Settings {
MarbleGame.canvas.scene2d.scaleMode = Zoom(zoomRatio);
if (MarbleGame.instance.world != null) {
MarbleGame.instance.world.scene.camera.setFovX(Settings.optionsSettings.fovX,
Settings.optionsSettings.screenWidth / Settings.optionsSettings.screenHeight);
}
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
});
}

View file

@ -288,8 +288,8 @@ class OptionsDlg extends GuiImage {
Settings.optionsSettings.soundVolume = val;
AudioManager.updateVolumes();
}, true);
makeSlider("Field of View:", (Settings.optionsSettings.fov - 60) / (140 - 60), 298, generalPanel, (val) -> {
Settings.optionsSettings.fov = cast(60 + val * (140 - 60));
makeSlider("Field of View:", (Settings.optionsSettings.fovX - 60) / (140 - 60), 298, generalPanel, (val) -> {
Settings.optionsSettings.fovX = cast(60 + val * (140 - 60));
});
makeSlider("Mouse Speed:", (Settings.controlsSettings.cameraSensitivity - 0.2) / (3 - 0.2), 298, generalPanel, (val) -> {
Settings.controlsSettings.cameraSensitivity = cast(0.2 + val * (3 - 0.2));