Loader: Add blur and image testing
This commit is contained in:
@@ -2,22 +2,35 @@ class Titlescreen{
|
||||
constructor(){
|
||||
loader.changePage("titlescreen")
|
||||
this.titleScreen = document.getElementById("title-screen")
|
||||
pageEvents.keyOnce(this, 13, "down").then(this.onPressed.bind(this))
|
||||
pageEvents.once(this.titleScreen, "mousedown").then(this.onPressed.bind(this))
|
||||
pageEvents.keyAdd(this, "all", "down", this.keyDown.bind(this))
|
||||
pageEvents.add(this.titleScreen, "mousedown", this.onPressed.bind(this))
|
||||
pageEvents.once(this.titleScreen, "touchstart").then(this.onPressed.bind(this))
|
||||
assets.sounds["title"].play()
|
||||
this.gamepad = new Gamepad({
|
||||
"start": ["a", "b", "x", "y", "start", "ls", "rs"]
|
||||
"13": ["a", "b", "x", "y", "start", "ls", "rs"]
|
||||
}, pressed => {
|
||||
if(pressed){
|
||||
this.onPressed()
|
||||
}
|
||||
})
|
||||
}
|
||||
keyDown(event, code){
|
||||
if(!code){
|
||||
code = event.keyCode
|
||||
}
|
||||
if(code == 13 || code == 32 || code == 86 || code == 66){
|
||||
// Enter, Space, V, B
|
||||
this.onPressed()
|
||||
}
|
||||
}
|
||||
onPressed(event){
|
||||
if(event && event.type === "touchstart"){
|
||||
event.preventDefault()
|
||||
this.touched = true
|
||||
if(event){
|
||||
if(event.type === "touchstart"){
|
||||
event.preventDefault()
|
||||
this.touched = true
|
||||
}else if(event.type === "mousedown" && event.which !== 1){
|
||||
return
|
||||
}
|
||||
}
|
||||
this.titleScreen.style.cursor = "auto"
|
||||
this.clean()
|
||||
@@ -34,7 +47,7 @@ class Titlescreen{
|
||||
clean(){
|
||||
this.gamepad.clean()
|
||||
assets.sounds["title"].stop()
|
||||
pageEvents.keyRemove(this, 13)
|
||||
pageEvents.keyRemove(this, "all")
|
||||
pageEvents.remove(this.titleScreen, "mousedown")
|
||||
pageEvents.remove(this.titleScreen, "touchstart")
|
||||
delete this.titleScreen
|
||||
|
||||
Reference in New Issue
Block a user