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 finish:Bool = false;
var _ignoreCursor:Bool = false;
public function new(marble:Marble) {
super();
this.marble = marble;
@ -88,6 +90,7 @@ class CameraController extends Object {
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
pointercontainer.hidden = true;
#end
_ignoreCursor = true;
Window.getInstance().lockPointer((x, y) -> orbit(x, y));
#if hl
Cursor.show(false);
@ -108,6 +111,10 @@ class CameraController extends Object {
}
public function orbit(mouseX:Float, mouseY:Float, isTouch:Bool = false) {
if (_ignoreCursor) {
_ignoreCursor = false;
return;
}
var scaleFactor = 1.0;
#if js
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"));
okbutton.position = new Vector(163, 182);
okbutton.extent = new Vector(78, 59);
okbutton.accelerator = hxd.Key.ENTER;
okbutton.pressedAction = (sender) -> {
MarbleGame.canvas.popDialog(this);
Settings.highscoreName = enterNameEdit.text.text;

View file

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