diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index ddf9a0c..ed3b645 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -10,3 +10,6 @@ tasks: - rm builds/* || true - go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o builds/rowboz.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh - for i in `ls builds/*windows*`; do mv -v $i $i.exe; done + lint: + cmds: + - golangci-lint run diff --git a/robots/render.go b/robots/render.go index d9501ef..bc58c96 100644 --- a/robots/render.go +++ b/robots/render.go @@ -1,7 +1,6 @@ package robots import ( - "runtime" "strconv" ) @@ -42,26 +41,28 @@ func (game *Game) drawBox() { } // drawCoords Print the coordinates of the player -func (game *Game) drawCoords() { - var x, y int = 25, 24 - for _, r := range []rune("[ x:" + strconv.FormatInt(int64(game.player.position.x), 10) + " y:" + strconv.FormatInt(int64(game.player.position.y), 10) + " ]") { - game.screen.SetContent(x, y-1, r, nil, game.style) - x++ - } -} +// func (game *Game) drawCoords() { +// var x, y int = 25, 24 +// for _, r := range []rune("[ x:" + strconv.FormatInt(int64(game.player.position.x), 10) + " y:" + strconv.FormatInt(int64(game.player.position.y), 10) + " ]") { +// game.screen.SetContent(x, y-1, r, nil, game.style) +// x++ +// } +// } -func (game *Game) drawDebug() { - var x, y int = 40, 24 - for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " Bots: " + strconv.FormatInt(int64(len(game.robots)), 10) + " ]") { - game.screen.SetContent(x, y-1, r, nil, game.style) - x++ - } -} +// func (game *Game) drawDebug() { +// var x, y int = 40, 24 +// for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " Bots: " + strconv.FormatInt(int64(len(game.robots)), 10) + " ]") { +// game.screen.SetContent(x, y-1, r, nil, game.style) +// x++ +// } +// } func (game *Game) drawScore() { var x, y int = 5, 24 - for _, r := range []rune("[ Score: " + strconv.FormatInt(int64(game.player.score), 10) + " Level: " + strconv.FormatInt(int64(game.level), 10) + " ]") { - game.screen.SetContent(x, y-1, r, nil, game.style) + content := "[ Score: " + strconv.FormatInt(int64(game.player.score), 10) + " Level: " + strconv.FormatInt(int64(game.level), 10) + " ]" + + for i := 0; i < len(content); i++ { + game.screen.SetContent(x, y-1, rune(content[i]), nil, game.style) x++ } }