mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
touch controls but its platform dependent
This commit is contained in:
parent
d4e0a23838
commit
a1dd6f3b55
4 changed files with 18 additions and 5 deletions
|
|
@ -136,7 +136,9 @@ class MarbleGame {
|
|||
world = null;
|
||||
return;
|
||||
}
|
||||
touchInput.update();
|
||||
if (Util.isTouchDevice()) {
|
||||
touchInput.update();
|
||||
}
|
||||
if (!paused) {
|
||||
world.update(dt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1011,9 +1011,13 @@ class MarbleWorld extends Scheduler {
|
|||
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
||||
pointercontainer.hidden = false;
|
||||
#end
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
||||
}
|
||||
egg = new EndGameGui((sender) -> {
|
||||
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
|
||||
}
|
||||
this.dispose();
|
||||
var pmg = new PlayMissionGui();
|
||||
PlayMissionGui.currentSelectionStatic = mission.index + 1;
|
||||
|
|
@ -1028,7 +1032,9 @@ class MarbleWorld extends Scheduler {
|
|||
#if js
|
||||
pointercontainer.hidden = true;
|
||||
#end
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(true);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(true);
|
||||
}
|
||||
// @:privateAccess playGui.playGuiCtrl.render(scene2d);
|
||||
}, mission, finishTime);
|
||||
MarbleGame.canvas.pushDialog(egg);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ class GuiTextInput extends GuiControl {
|
|||
#if js
|
||||
if (Util.isTouchDevice()) {
|
||||
text.text = js.Browser.window.prompt("Enter your name", text.text);
|
||||
var canvas = js.Browser.document.querySelector("#webgl");
|
||||
canvas.focus();
|
||||
js.Browser.document.documentElement.requestFullscreen();
|
||||
}
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import src.Resource;
|
|||
import hxd.res.Sound;
|
||||
import h3d.mat.Texture;
|
||||
import src.Settings;
|
||||
import src.Util;
|
||||
|
||||
class PlayGui {
|
||||
var scene2d:h2d.Scene;
|
||||
|
|
@ -130,7 +131,9 @@ class PlayGui {
|
|||
initPowerupBox();
|
||||
initTexts();
|
||||
|
||||
MarbleGame.instance.touchInput.showControls(this.playGuiCtrl);
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.showControls(this.playGuiCtrl);
|
||||
}
|
||||
|
||||
playGuiCtrl.render(scene2d);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue