prepare for gamepads
This commit is contained in:
parent
711c0e25ac
commit
815a589b23
|
|
@ -52,10 +52,10 @@ https://wakamaifondue.com/
|
|||
|
||||
## Pluto Goals: Phase 2
|
||||
|
||||
- [ ] pico8-style games
|
||||
- [ ] public tunnel for your NOSE webapps
|
||||
- [ ] public tunnel lives through reboots
|
||||
- [ ] self updating NOSE server
|
||||
- [ ] `pub/` static hosting in webapps
|
||||
- [ ] game/bin/www cartridges
|
||||
- [ ] upload files to project
|
||||
- [ ] upload files to projects
|
||||
- [ ] pico8-style games
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ export function update(_delta: number, input: InputState) {
|
|||
paused = !paused
|
||||
if (paused) return
|
||||
|
||||
if (input.justPressed.has(" ")) {
|
||||
if (input.justPressed.has(" ") || input.justPressed.has("z")) {
|
||||
rotateShape()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ export async function handleGameStart(msg: Message) {
|
|||
canvas = createCanvas()
|
||||
canvas.focus()
|
||||
setStatus(msgId, "ok")
|
||||
canvas.addEventListener("keydown", handleKeydown)
|
||||
canvas.addEventListener("keyup", handleKeyup)
|
||||
window.addEventListener("keydown", handleKeydown)
|
||||
window.addEventListener("keyup", handleKeyup)
|
||||
window.addEventListener("resize", resizeCanvas)
|
||||
resizeCanvas()
|
||||
gameLoop(new GameContext(canvas.getContext("2d")!), game)
|
||||
|
|
@ -137,6 +137,10 @@ function gameLoop(ctx: GameContext, game: Game) {
|
|||
function endGame() {
|
||||
running = false
|
||||
|
||||
window.removeEventListener("keydown", handleKeydown)
|
||||
window.removeEventListener("keyup", handleKeyup)
|
||||
window.removeEventListener("resize", resizeCanvas)
|
||||
|
||||
if (oldMode === "tall") browserCommands.mode?.()
|
||||
|
||||
canvas.classList.remove("active")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user