repackage code to cmd
104
Makefile
@@ -1,15 +1,101 @@
|
|||||||
.PHONY all:
|
# Copyright © 2024 Thomas von Dein
|
||||||
all: build
|
|
||||||
|
|
||||||
.PHONY: build
|
# This program is free software: you can redistribute it and/or modify
|
||||||
build:
|
# it under the terms of the GNU General Public License as published by
|
||||||
make -C src
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
mv src/golsky .
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# no need to modify anything below
|
||||||
|
tool = golsky
|
||||||
|
VERSION = $(shell grep VERSION main.go | head -1 | cut -d '"' -f2)
|
||||||
|
archs = darwin freebsd linux windows
|
||||||
|
PREFIX = /usr/local
|
||||||
|
UID = root
|
||||||
|
GID = 0
|
||||||
|
HAVE_POD := $(shell pod2text -h 2>/dev/null)
|
||||||
|
#TAGS = -tags=ebitenginedebug
|
||||||
|
|
||||||
|
all: buildlocal
|
||||||
|
|
||||||
|
|
||||||
|
buildlocal:
|
||||||
|
go build $(TAGS) -o $(tool)
|
||||||
|
|
||||||
|
install: buildlocal
|
||||||
|
install -d -o $(UID) -g $(GID) $(PREFIX)/bin
|
||||||
|
install -d -o $(UID) -g $(GID) $(PREFIX)/man/man1
|
||||||
|
install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/
|
||||||
|
install -o $(UID) -g $(GID) -m 444 $(tool).1 $(PREFIX)/man/man1/
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
clean:
|
||||||
make -C src clean
|
rm -rf $(tool) coverage.out testdata t/out
|
||||||
rm -f dump* rect*
|
|
||||||
|
test: clean
|
||||||
|
mkdir -p t/out
|
||||||
|
go test ./... $(ARGS)
|
||||||
|
|
||||||
|
testlint: test lint
|
||||||
|
|
||||||
|
lint:
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
lint-full:
|
||||||
|
golangci-lint run --enable-all --exclude-use-default --disable exhaustivestruct,exhaustruct,depguard,interfacer,deadcode,golint,structcheck,scopelint,varcheck,ifshort,maligned,nosnakecase,godot,funlen,gofumpt,cyclop,noctx,gochecknoglobals,paralleltest
|
||||||
|
|
||||||
|
testfuzzy: clean
|
||||||
|
go test -fuzz ./... $(ARGS)
|
||||||
|
|
||||||
|
singletest:
|
||||||
|
@echo "Call like this: make singletest TEST=TestPrepareColumns ARGS=-v"
|
||||||
|
go test -run $(TEST) $(ARGS)
|
||||||
|
|
||||||
|
cover-report:
|
||||||
|
go test ./... -cover -coverprofile=coverage.out
|
||||||
|
go tool cover -html=coverage.out
|
||||||
|
|
||||||
|
goupdate:
|
||||||
|
go get -t -u=patch ./...
|
||||||
|
|
||||||
|
buildall:
|
||||||
|
./mkrel.sh $(tool) $(VERSION)
|
||||||
|
|
||||||
|
release: buildall
|
||||||
|
gh release create $(VERSION) --generate-notes releases/*
|
||||||
|
|
||||||
|
show-versions: buildlocal
|
||||||
|
@echo "### golsky version:"
|
||||||
|
@./golsky -V
|
||||||
|
|
||||||
|
@echo
|
||||||
|
@echo "### go module versions:"
|
||||||
|
@go list -m all
|
||||||
|
|
||||||
|
@echo
|
||||||
|
@echo "### go version used for building:"
|
||||||
|
@grep -m 1 go go.mod
|
||||||
|
|
||||||
|
# lint:
|
||||||
|
# golangci-lint run -p bugs -p unused
|
||||||
|
|
||||||
|
buildwasm:
|
||||||
|
env GOOS=js GOARCH=wasm go build -o $(tool).wasm $(LDFLAGS) .
|
||||||
|
|
||||||
|
zipwasm:
|
||||||
|
zip -r openquell-$(SHORTVERSION).zip index.html $(tool).wasm wasm_exec.js
|
||||||
|
|
||||||
|
wasm: buildwasm zipwasm
|
||||||
|
@ls -l $(tool)-$(SHORTVERSION).zip
|
||||||
|
|
||||||
|
|
||||||
.PHONY: profile
|
.PHONY: profile
|
||||||
profile: build
|
profile: build
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
|
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
@@ -1,6 +1,6 @@
|
|||||||
// this comes from the camera example but I enhanced it a little bit
|
// this comes from the camera example but I enhanced it a little bit
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
// find an item in a list, generic variant
|
// find an item in a list, generic variant
|
||||||
func Contains[E comparable](s []E, v E) bool {
|
func Contains[E comparable](s []E, v E) bool {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import "github.com/hajimehoshi/ebiten/v2"
|
import "github.com/hajimehoshi/ebiten/v2"
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import "runtime"
|
import "runtime"
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
|
|
||||||
|
"codeberg.org/scip/golsky/cmd"
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,22 +19,22 @@ func main() {
|
|||||||
directstart = true
|
directstart = true
|
||||||
}
|
}
|
||||||
|
|
||||||
config, err := ParseCommandline()
|
config, err := cmd.ParseCommandline()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.ShowVersion {
|
if config.ShowVersion {
|
||||||
fmt.Printf("This is golsky version %s\n", VERSION)
|
fmt.Printf("This is golsky version %s\n", cmd.VERSION)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
start := Play
|
start := cmd.Play
|
||||||
if !directstart {
|
if !directstart {
|
||||||
start = Menu
|
start = cmd.Menu
|
||||||
config.DelayedStart = true
|
config.DelayedStart = true
|
||||||
}
|
}
|
||||||
game := NewGame(config, SceneName(start))
|
game := cmd.NewGame(config, cmd.SceneName(start))
|
||||||
|
|
||||||
if config.ProfileFile != "" {
|
if config.ProfileFile != "" {
|
||||||
// enable cpu profiling. Do NOT use q to stop the game but
|
// enable cpu profiling. Do NOT use q to stop the game but
|
||||||
97
src/Makefile
@@ -1,97 +0,0 @@
|
|||||||
# Copyright © 2024 Thomas von Dein
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# no need to modify anything below
|
|
||||||
tool = golsky
|
|
||||||
VERSION = $(shell grep VERSION main.go | head -1 | cut -d '"' -f2)
|
|
||||||
archs = darwin freebsd linux windows
|
|
||||||
PREFIX = /usr/local
|
|
||||||
UID = root
|
|
||||||
GID = 0
|
|
||||||
HAVE_POD := $(shell pod2text -h 2>/dev/null)
|
|
||||||
#TAGS = -tags=ebitenginedebug
|
|
||||||
|
|
||||||
all: buildlocal
|
|
||||||
|
|
||||||
|
|
||||||
buildlocal:
|
|
||||||
go build $(TAGS) -o $(tool)
|
|
||||||
|
|
||||||
install: buildlocal
|
|
||||||
install -d -o $(UID) -g $(GID) $(PREFIX)/bin
|
|
||||||
install -d -o $(UID) -g $(GID) $(PREFIX)/man/man1
|
|
||||||
install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/
|
|
||||||
install -o $(UID) -g $(GID) -m 444 $(tool).1 $(PREFIX)/man/man1/
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(tool) coverage.out testdata t/out
|
|
||||||
|
|
||||||
test: clean
|
|
||||||
mkdir -p t/out
|
|
||||||
go test ./... $(ARGS)
|
|
||||||
|
|
||||||
testlint: test lint
|
|
||||||
|
|
||||||
lint:
|
|
||||||
golangci-lint run
|
|
||||||
|
|
||||||
lint-full:
|
|
||||||
golangci-lint run --enable-all --exclude-use-default --disable exhaustivestruct,exhaustruct,depguard,interfacer,deadcode,golint,structcheck,scopelint,varcheck,ifshort,maligned,nosnakecase,godot,funlen,gofumpt,cyclop,noctx,gochecknoglobals,paralleltest
|
|
||||||
|
|
||||||
testfuzzy: clean
|
|
||||||
go test -fuzz ./... $(ARGS)
|
|
||||||
|
|
||||||
singletest:
|
|
||||||
@echo "Call like this: make singletest TEST=TestPrepareColumns ARGS=-v"
|
|
||||||
go test -run $(TEST) $(ARGS)
|
|
||||||
|
|
||||||
cover-report:
|
|
||||||
go test ./... -cover -coverprofile=coverage.out
|
|
||||||
go tool cover -html=coverage.out
|
|
||||||
|
|
||||||
goupdate:
|
|
||||||
go get -t -u=patch ./...
|
|
||||||
|
|
||||||
buildall:
|
|
||||||
./mkrel.sh $(tool) $(VERSION)
|
|
||||||
|
|
||||||
release: buildall
|
|
||||||
gh release create $(VERSION) --generate-notes releases/*
|
|
||||||
|
|
||||||
show-versions: buildlocal
|
|
||||||
@echo "### golsky version:"
|
|
||||||
@./golsky -V
|
|
||||||
|
|
||||||
@echo
|
|
||||||
@echo "### go module versions:"
|
|
||||||
@go list -m all
|
|
||||||
|
|
||||||
@echo
|
|
||||||
@echo "### go version used for building:"
|
|
||||||
@grep -m 1 go go.mod
|
|
||||||
|
|
||||||
# lint:
|
|
||||||
# golangci-lint run -p bugs -p unused
|
|
||||||
|
|
||||||
buildwasm:
|
|
||||||
env GOOS=js GOARCH=wasm go build -o $(tool).wasm $(LDFLAGS) .
|
|
||||||
|
|
||||||
zipwasm:
|
|
||||||
zip -r openquell-$(SHORTVERSION).zip index.html $(tool).wasm wasm_exec.js
|
|
||||||
|
|
||||||
wasm: buildwasm zipwasm
|
|
||||||
@ls -l $(tool)-$(SHORTVERSION).zip
|
|
||||||