Fix restart button (keypresses got buffered)
This commit is contained in:
parent
086147aa81
commit
8fe6b9752e
13
main.go
13
main.go
@ -157,8 +157,6 @@ func (gs *gameState) layout(g *gocui.Gui) error {
|
|||||||
if _, err := g.SetCurrentView("game"); err != nil {
|
if _, err := g.SetCurrentView("game"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Editor = gocui.EditorFunc(gs.gameEditor)
|
|
||||||
v.Editable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart button - positioned below the game view
|
// Restart button - positioned below the game view
|
||||||
@ -252,17 +250,6 @@ func (gs *gameState) handleMouseClick(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return nil
|
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) {
|
func (gs *gameState) openCell(x, y int) {
|
||||||
if x < 0 || y < 0 || x >= gs.rows || y >= gs.cols || gs.field[x][y].isOpen {
|
if x < 0 || y < 0 || x >= gs.rows || y >= gs.cols || gs.field[x][y].isOpen {
|
||||||
return // Bounds check and already opened check
|
return // Bounds check and already opened check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user