Update via to v0.4.0 and decouple tick rate from snake speed
Use via.OnKeyDownMap for snake keybindings, replacing the manual dataExpr/rawDataAttr workaround. Window-scoped key handling removes the need for tabindex/focus hacks, and WithPreventDefault on arrow keys prevents page scrolling during gameplay. Introduce a 60 FPS tick loop with a separate snake movement speed (7 cells/s) so direction input is polled every frame but game state only advances at the configured rate.
This commit is contained in:
4
go.mod
4
go.mod
@@ -5,8 +5,9 @@ go 1.25.4
|
||||
require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/pressly/goose/v3 v3.26.0
|
||||
github.com/ryanhamamura/via v0.3.1
|
||||
github.com/ryanhamamura/via v0.4.0
|
||||
golang.org/x/crypto v0.47.0
|
||||
maragu.dev/gomponents v1.2.0
|
||||
modernc.org/sqlite v1.44.0
|
||||
)
|
||||
|
||||
@@ -42,7 +43,6 @@ require (
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
maragu.dev/gomponents v1.2.0 // indirect
|
||||
modernc.org/libc v1.67.4 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user