Skip to content

Commit

Permalink
feat(game): Double keyboard scroll speed
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 15, 2024
1 parent 4db020f commit 7ec1c76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/game/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,29 +197,29 @@ func (g *Game) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if g.wrap {
g.pattern.Grid = append(g.pattern.Grid[len(g.pattern.Grid)-1:], g.pattern.Grid[:len(g.pattern.Grid)-1]...)
} else {
g.y = max(g.y-1, 0)
g.y = max(g.y-2, 0)
}
case key.Matches(msg, g.keymap.moveLeft):
if g.wrap {
for i, row := range g.pattern.Grid {
g.pattern.Grid[i] = append(row[len(row)-1:], row[:len(row)-1]...)
}
} else {
g.x = max(g.x-1, 0)
g.x = max(g.x-2, 0)
}
case key.Matches(msg, g.keymap.moveDown):
if g.wrap {
g.pattern.Grid = append(g.pattern.Grid[1:], g.pattern.Grid[0])
} else {
g.y = min(g.y+1, g.BoardH()-g.viewH)
g.y = min(g.y+2, g.BoardH()-g.viewH)
}
case key.Matches(msg, g.keymap.moveRight):
if g.wrap {
for i, row := range g.pattern.Grid {
g.pattern.Grid[i] = append(row[1:], row[0])
}
} else {
g.x = min(g.x+1, g.BoardW()-g.viewW)
g.x = min(g.x+2, g.BoardW()-g.viewW)
}
case key.Matches(msg, g.keymap.wrap):
g.wrap = !g.wrap
Expand Down

0 comments on commit 7ec1c76

Please sign in to comment.