1
1
Fork 0
mirror of https://gitlab.com/Oreolek/salet-gamepad-module.git synced 2024-04-25 21:59:37 +03:00

enter/exit options room

This commit is contained in:
Alexander Yakovlev 2017-09-22 23:59:49 +07:00
parent 373f74b2db
commit fd817756f3

View file

@ -31,6 +31,15 @@ selectOption = (event, button) ->
return return
$(".options li.active").click() $(".options li.active").click()
# enter the options room
enterOptions = (event, button) ->
if button != "back" and button != "start"
return
if button == "start"
return salet.goTo(salet.optionsRoom)
if button == "back" and salet.currentRoom == salet.optionsRoom
return salet.goBack()
# Joystick check, fires events # Joystick check, fires events
joystick = () -> joystick = () ->
if typeof navigator.getGamepads == "function" if typeof navigator.getGamepads == "function"
@ -59,3 +68,4 @@ window.selectedoption ?= 1
$(document).on("press", selectUp) $(document).on("press", selectUp)
$(document).on("press", selectDown) $(document).on("press", selectDown)
$(document).on("press", selectOption) $(document).on("press", selectOption)
$(document).on("press", enterOptions)