diff --git a/ui.go b/ui.go index e3fdb72..906ab3f 100644 --- a/ui.go +++ b/ui.go @@ -69,6 +69,16 @@ func (ui *ui) menu() { ui.writeString(0, height-1, "fart", tcell.StyleDefault) ui.screen.Sync() + type point struct{ x, y int } + position := point{10, 10} + + redraw := func() { + ui.screen.Clear() + ui.screen.SetContent(position.x, position.y, '+', nil, tcell.StyleDefault) + ui.screen.Show() + } + redraw() + for { e := ui.screen.PollEvent() if e == nil { @@ -81,6 +91,22 @@ func (ui *ui) menu() { if key == tcell.KeyCtrlC { return } + if key == tcell.KeyRune { + switch v.Rune() { + case 'w': + position.y-- + redraw() + case 'a': + position.x-- + redraw() + case 's': + position.y++ + redraw() + case 'd': + position.x++ + redraw() + } + } default: log.Debug("screen saw unhandled event of type %T", e) } diff --git a/ui_mode.go b/ui_mode.go new file mode 100644 index 0000000..fe65cd4 --- /dev/null +++ b/ui_mode.go @@ -0,0 +1,4 @@ +package main + +type uiMode interface { +}