40 lines
586 B
Go
40 lines
586 B
Go
package stages
|
|
|
|
import (
|
|
"inp2025/models"
|
|
"strings"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type GameModel struct {
|
|
state models.GameState
|
|
}
|
|
|
|
func NewGameModel() *GameModel {
|
|
return &GameModel{}
|
|
}
|
|
|
|
func (m *GameModel) Init() tea.Cmd {
|
|
return tea.ClearScreen
|
|
}
|
|
|
|
func (m *GameModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
var cmds []tea.Cmd
|
|
|
|
switch msg := msg.(type) {
|
|
case tea.KeyMsg:
|
|
switch msg.String() {
|
|
case "ctrl+c":
|
|
return m, tea.Quit
|
|
}
|
|
}
|
|
|
|
return m, tea.Batch(cmds...)
|
|
}
|
|
|
|
func (m *GameModel) View() string {
|
|
var b strings.Builder
|
|
return b.String()
|
|
}
|