View: Add touch controls

This commit is contained in:
LoveEevee
2018-10-05 20:03:59 +03:00
parent 724c82814e
commit c8acfc3188
12 changed files with 362 additions and 33 deletions

View File

@@ -3,7 +3,8 @@ class Titlescreen{
loader.changePage("titlescreen")
this.titleScreen = document.getElementById("title-screen")
pageEvents.keyOnce(this, 13, "down").then(this.onPressed.bind(this))
pageEvents.once(this.titleScreen, "click").then(this.onPressed.bind(this))
pageEvents.once(this.titleScreen, "mousedown").then(this.onPressed.bind(this))
pageEvents.once(this.titleScreen, "touchstart").then(this.onPressed.bind(this))
assets.sounds["title"].play()
this.gamepad = new Gamepad({
"start": ["b", "x", "y", "start"],
@@ -15,6 +16,7 @@ class Titlescreen{
})
}
onPressed(){
this.titleScreen.style.cursor = "auto"
this.clean()
assets.sounds["don"].play()
setTimeout(this.goNext.bind(this), 500)
@@ -22,7 +24,7 @@ class Titlescreen{
goNext(){
if(localStorage.getItem("tutorial") !== "true"){
new Tutorial()
} else {
}else{
new SongSelect()
}
}
@@ -30,7 +32,8 @@ class Titlescreen{
this.gamepad.clean()
assets.sounds["title"].stop()
pageEvents.keyRemove(this, 13)
pageEvents.remove(this.titleScreen, "click")
pageEvents.remove(this.titleScreen, "mousedown")
pageEvents.remove(this.titleScreen, "touchstart")
delete this.titleScreen
}
}