Compare commits
No commits in common. "trunk" and "v20231212" have entirely different histories.
24
.gitignore
vendored
24
.gitignore
vendored
@ -1 +1,23 @@
|
|||||||
builds
|
# ---> Go
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v4.6.0 # this is optional, use `pre-commit autoupdate` to get the latest rev!
|
|
||||||
hooks:
|
|
||||||
- id: check-yaml
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
- id: trailing-whitespace
|
|
@ -1,15 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
default:
|
|
||||||
cmds:
|
|
||||||
- go run .
|
|
||||||
build:
|
|
||||||
cmds:
|
|
||||||
- mkdir -p builds
|
|
||||||
- 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
|
|
@ -99,7 +99,7 @@ func (game *Game) gameDirector() {
|
|||||||
|
|
||||||
// Draw stuff last
|
// Draw stuff last
|
||||||
game.drawScore()
|
game.drawScore()
|
||||||
//game.drawDebug()
|
game.drawDebug()
|
||||||
|
|
||||||
// Draw the screen
|
// Draw the screen
|
||||||
game.screen.Show()
|
game.screen.Show()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package robots
|
package robots
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,28 +42,26 @@ func (game *Game) drawBox() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// drawCoords Print the coordinates of the player
|
// drawCoords Print the coordinates of the player
|
||||||
// func (game *Game) drawCoords() {
|
func (game *Game) drawCoords() {
|
||||||
// var x, y int = 25, 24
|
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) + " ]") {
|
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)
|
game.screen.SetContent(x, y-1, r, nil, game.style)
|
||||||
// x++
|
x++
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func (game *Game) drawDebug() {
|
func (game *Game) drawDebug() {
|
||||||
// var x, y int = 40, 24
|
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) + " ]") {
|
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)
|
game.screen.SetContent(x, y-1, r, nil, game.style)
|
||||||
// x++
|
x++
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
func (game *Game) drawScore() {
|
func (game *Game) drawScore() {
|
||||||
var x, y int = 5, 24
|
var x, y int = 5, 24
|
||||||
content := "[ Score: " + strconv.FormatInt(int64(game.player.score), 10) + " Level: " + strconv.FormatInt(int64(game.level), 10) + " ]"
|
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)
|
||||||
for i := 0; i < len(content); i++ {
|
|
||||||
game.screen.SetContent(x, y-1, rune(content[i]), nil, game.style)
|
|
||||||
x++
|
x++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user