diff --git a/src/CameraController.hx b/src/CameraController.hx index e43e8564..cfcfaa39 100644 --- a/src/CameraController.hx +++ b/src/CameraController.hx @@ -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(); } diff --git a/src/Settings.hx b/src/Settings.hx index 95eaa83a..4e68c950 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -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); }); } diff --git a/src/gui/OptionsDlg.hx b/src/gui/OptionsDlg.hx index d5efe7e0..225e8a1f 100644 --- a/src/gui/OptionsDlg.hx +++ b/src/gui/OptionsDlg.hx @@ -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));