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