package main import ( "log" "github.com/kettek/goro" ) func main() { // Initialize goro! if err := goro.InitTCell(); err != nil { log.Fatal(err) } goro.Run(func(screen *goro.Screen) { // Screen configuration. screen.SetTitle("Steel Lord") screen.SetSize(60, 14) // Our initial variables. playerX, playerY := screen.Columns/2, screen.Rows/2 // The game loop. for { // Draw screen. screen.DrawRune(playerX, playerY, '@', goro.Style{ Foreground: goro.ColorRed, }) screen.Flush() screen.DrawRune(playerX, playerY, ' ', goro.Style{}) // Handle events. switch event := screen.WaitEvent().(type) { case goro.EventKey: switch action := handleKeyEvent(event).(type) { case ActionMove: playerX += action.X playerY += action.Y case ActionQuit: goro.Quit() } case goro.EventQuit: return } } }) }