accelerator key fixes and fix camera on unpause

This commit is contained in:
RandomityGuy 2022-12-17 14:39:47 +05:30
parent d974d14d1e
commit 5b766c8dc0
3 changed files with 8 additions and 1 deletions

View file

@ -68,6 +68,8 @@ class CameraController extends Object {
public var oob:Bool = false; public var oob:Bool = false;
public var finish:Bool = false; public var finish:Bool = false;
var _ignoreCursor:Bool = false;
public function new(marble:Marble) { public function new(marble:Marble) {
super(); super();
this.marble = marble; this.marble = marble;
@ -88,6 +90,7 @@ class CameraController extends Object {
var pointercontainer = js.Browser.document.querySelector("#pointercontainer"); var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
pointercontainer.hidden = true; pointercontainer.hidden = true;
#end #end
_ignoreCursor = true;
Window.getInstance().lockPointer((x, y) -> orbit(x, y)); Window.getInstance().lockPointer((x, y) -> orbit(x, y));
#if hl #if hl
Cursor.show(false); Cursor.show(false);
@ -108,6 +111,10 @@ class CameraController extends Object {
} }
public function orbit(mouseX:Float, mouseY:Float, isTouch:Bool = false) { public function orbit(mouseX:Float, mouseY:Float, isTouch:Bool = false) {
if (_ignoreCursor) {
_ignoreCursor = false;
return;
}
var scaleFactor = 1.0; var scaleFactor = 1.0;
#if js #if js
scaleFactor = 1 / js.Browser.window.devicePixelRatio; scaleFactor = 1 / js.Browser.window.devicePixelRatio;

View file

@ -65,6 +65,7 @@ class EnterNameDlg extends GuiControl {
var okbutton = new GuiButton(loadButtonImages("data/ui/common/ok")); var okbutton = new GuiButton(loadButtonImages("data/ui/common/ok"));
okbutton.position = new Vector(163, 182); okbutton.position = new Vector(163, 182);
okbutton.extent = new Vector(78, 59); okbutton.extent = new Vector(78, 59);
okbutton.accelerator = hxd.Key.ENTER;
okbutton.pressedAction = (sender) -> { okbutton.pressedAction = (sender) -> {
MarbleGame.canvas.popDialog(this); MarbleGame.canvas.popDialog(this);
Settings.highscoreName = enterNameEdit.text.text; Settings.highscoreName = enterNameEdit.text.text;

View file

@ -54,7 +54,6 @@ class ExitGameDlg extends GuiControl {
noButton.extent = new Vector(83, 55); noButton.extent = new Vector(83, 55);
noButton.vertSizing = Bottom; noButton.vertSizing = Bottom;
noButton.horizSizing = Right; noButton.horizSizing = Right;
noButton.accelerator = hxd.Key.ESCAPE;
noButton.pressedAction = noFunc; noButton.pressedAction = noFunc;
var restartButton = new GuiButton(loadButtonImages("data/ui/common/restart")); var restartButton = new GuiButton(loadButtonImages("data/ui/common/restart"));