|
|
@ -69,6 +69,16 @@ func (ui *ui) menu() {
|
|
|
|
ui.writeString(0, height-1, "fart", tcell.StyleDefault)
|
|
|
|
ui.writeString(0, height-1, "fart", tcell.StyleDefault)
|
|
|
|
ui.screen.Sync()
|
|
|
|
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 {
|
|
|
|
for {
|
|
|
|
e := ui.screen.PollEvent()
|
|
|
|
e := ui.screen.PollEvent()
|
|
|
|
if e == nil {
|
|
|
|
if e == nil {
|
|
|
@ -81,6 +91,22 @@ func (ui *ui) menu() {
|
|
|
|
if key == tcell.KeyCtrlC {
|
|
|
|
if key == tcell.KeyCtrlC {
|
|
|
|
return
|
|
|
|
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:
|
|
|
|
default:
|
|
|
|
log.Debug("screen saw unhandled event of type %T", e)
|
|
|
|
log.Debug("screen saw unhandled event of type %T", e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|