Fix restart button (keypresses got buffered)

This commit is contained in:
bdnugget 2025-03-16 22:55:45 +01:00
parent 086147aa81
commit 8fe6b9752e

13
main.go
View File

@ -157,8 +157,6 @@ func (gs *gameState) layout(g *gocui.Gui) error {
if _, err := g.SetCurrentView("game"); err != nil {
return err
}
v.Editor = gocui.EditorFunc(gs.gameEditor)
v.Editable = true
}
// Restart button - positioned below the game view
@ -252,17 +250,6 @@ func (gs *gameState) handleMouseClick(g *gocui.Gui, v *gocui.View) error {
return nil
}
// Handle keyboard input for the game
func (gs *gameState) gameEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) {
// Handle keyboard input for the game
if key == gocui.KeyArrowUp {
// Move cursor up
} else if key == gocui.KeyArrowDown {
// Move cursor down
}
// etc.
}
func (gs *gameState) openCell(x, y int) {
if x < 0 || y < 0 || x >= gs.rows || y >= gs.cols || gs.field[x][y].isOpen {
return // Bounds check and already opened check