mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
accelerator keys
This commit is contained in:
parent
194ccc6b6a
commit
d974d14d1e
6 changed files with 14 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ class EndGameGui extends GuiControl {
|
||||||
continueButton.vertSizing = Bottom;
|
continueButton.vertSizing = Bottom;
|
||||||
continueButton.position = new Vector(333, 386);
|
continueButton.position = new Vector(333, 386);
|
||||||
continueButton.extent = new Vector(113, 47);
|
continueButton.extent = new Vector(113, 47);
|
||||||
|
continueButton.accelerator = hxd.Key.ENTER;
|
||||||
continueButton.pressedAction = continueFunc;
|
continueButton.pressedAction = continueFunc;
|
||||||
|
|
||||||
var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay"));
|
var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay"));
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,14 @@ class ExitGameDlg extends GuiControl {
|
||||||
yesButton.vertSizing = Bottom;
|
yesButton.vertSizing = Bottom;
|
||||||
yesButton.horizSizing = Right;
|
yesButton.horizSizing = Right;
|
||||||
yesButton.pressedAction = yesFunc;
|
yesButton.pressedAction = yesFunc;
|
||||||
|
yesButton.accelerator = hxd.Key.ENTER;
|
||||||
|
|
||||||
var noButton = new GuiButton(loadButtonImages("data/ui/common/no"));
|
var noButton = new GuiButton(loadButtonImages("data/ui/common/no"));
|
||||||
noButton.position = new Vector(151, 107);
|
noButton.position = new Vector(151, 107);
|
||||||
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"));
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ class GuiButton extends GuiAnim {
|
||||||
|
|
||||||
public var buttonSounds:Bool = true;
|
public var buttonSounds:Bool = true;
|
||||||
|
|
||||||
|
public var accelerator:Int = 0;
|
||||||
|
|
||||||
public function new(anim:Array<Tile>) {
|
public function new(anim:Array<Tile>) {
|
||||||
super(anim);
|
super(anim);
|
||||||
}
|
}
|
||||||
|
|
@ -67,6 +69,11 @@ class GuiButton extends GuiAnim {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!disabled && accelerator != 0 && hxd.Key.isReleased(accelerator)) {
|
||||||
|
if (this.pressedAction != null) {
|
||||||
|
this.pressedAction(new GuiEvent(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
super.update(dt, mouseState);
|
super.update(dt, mouseState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ class HelpCreditsGui extends GuiImage {
|
||||||
var homeButton = new GuiButton(loadButtonImages("data/ui/play/back"));
|
var homeButton = new GuiButton(loadButtonImages("data/ui/play/back"));
|
||||||
homeButton.position = new Vector(278, 378);
|
homeButton.position = new Vector(278, 378);
|
||||||
homeButton.extent = new Vector(79, 61);
|
homeButton.extent = new Vector(79, 61);
|
||||||
|
homeButton.accelerator = hxd.Key.ESCAPE;
|
||||||
homeButton.pressedAction = (sender) -> {
|
homeButton.pressedAction = (sender) -> {
|
||||||
MarbleGame.canvas.setContent(new MainMenuGui());
|
MarbleGame.canvas.setContent(new MainMenuGui());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ class MessageBoxOkDlg extends GuiControl {
|
||||||
okButton.position = new Vector(117, 85);
|
okButton.position = new Vector(117, 85);
|
||||||
okButton.extent = new Vector(78, 59);
|
okButton.extent = new Vector(78, 59);
|
||||||
okButton.vertSizing = Top;
|
okButton.vertSizing = Top;
|
||||||
|
okButton.accelerator = hxd.Key.ENTER;
|
||||||
okButton.pressedAction = (sender) -> {
|
okButton.pressedAction = (sender) -> {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ class MessageBoxYesNoDlg extends GuiControl {
|
||||||
yesButton.position = new Vector(44, 94);
|
yesButton.position = new Vector(44, 94);
|
||||||
yesButton.extent = new Vector(82, 47);
|
yesButton.extent = new Vector(82, 47);
|
||||||
yesButton.vertSizing = Top;
|
yesButton.vertSizing = Top;
|
||||||
|
yesButton.accelerator = hxd.Key.ENTER;
|
||||||
yesButton.pressedAction = (sender) -> {
|
yesButton.pressedAction = (sender) -> {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
yesFunc();
|
yesFunc();
|
||||||
|
|
@ -56,6 +57,7 @@ class MessageBoxYesNoDlg extends GuiControl {
|
||||||
noButton.position = new Vector(151, 94);
|
noButton.position = new Vector(151, 94);
|
||||||
noButton.extent = new Vector(75, 47);
|
noButton.extent = new Vector(75, 47);
|
||||||
noButton.vertSizing = Top;
|
noButton.vertSizing = Top;
|
||||||
|
noButton.accelerator = hxd.Key.ESCAPE;
|
||||||
noButton.pressedAction = (sender) -> {
|
noButton.pressedAction = (sender) -> {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
noFunc();
|
noFunc();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue