From 12b505fe7c4aabf508d3d9c705abd2ba1967aafb Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:47:25 +0530 Subject: [PATCH] change fov mode --- src/CameraController.hx | 2 +- src/Settings.hx | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) 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 5f0a7b5e..33b3be51 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -32,7 +32,7 @@ typedef OptionsSettings = { var musicVolume:Float; var soundVolume:Float; var vsync:Bool; - var fov:Int; + var fovX:Int; } typedef ControlsSettings = { @@ -74,7 +74,7 @@ class Settings { shadows: false, musicVolume: 1, soundVolume: 0.7, - fov: 60, + fovX: 90, vsync: #if js true #end #if hl false @@ -217,8 +217,8 @@ class Settings { highScores.set(key, value); } 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; @@ -270,6 +270,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); }); }