Compare commits
5 Commits
66eaa054c5
...
ea26db29f3
Author | SHA1 | Date | |
---|---|---|---|
ea26db29f3 | |||
d24b4eb376 | |||
855db3375c | |||
822d8ab584 | |||
b7b663ddb5 |
@ -118,6 +118,11 @@ go generate opslag.de/schobers/tins2020/cmd/tins2020
|
|||||||
go install opslag.de/schobers/tins2020/cmd/tins2020 -tags static -ldflags "-s -w"
|
go install opslag.de/schobers/tins2020/cmd/tins2020 -tags static -ldflags "-s -w"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to use the Allegro backend you can add the build tag `allegro` to the `go install` command. E.g.:
|
||||||
|
```
|
||||||
|
go install opslag.de/schobers/tins2020/cmd/tins2020 -tags static,allegro -ldflags "-s -w"
|
||||||
|
```
|
||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
Can be found at https://opslag.de/schobers/tins2020 (Git repository).
|
Can be found at https://opslag.de/schobers/tins2020 (Git repository).
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ import (
|
|||||||
"opslag.de/schobers/zntg/play"
|
"opslag.de/schobers/zntg/play"
|
||||||
"opslag.de/schobers/zntg/ui"
|
"opslag.de/schobers/zntg/ui"
|
||||||
|
|
||||||
_ "opslag.de/schobers/zntg/sdlui" // rendering backend
|
|
||||||
// _ "opslag.de/schobers/zntg/allg5ui" // rendering backend
|
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
rice "github.com/GeertJohan/go.rice"
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
"opslag.de/schobers/tins2020"
|
"opslag.de/schobers/tins2020"
|
||||||
|
13
cmd/tins2020/tins2020_allegro.go
Normal file
13
cmd/tins2020/tins2020_allegro.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// +build allegro
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
_ "opslag.de/schobers/zntg/allg5ui" // rendering backend
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
log.Println("Using Allegro5 rendering backend")
|
||||||
|
}
|
13
cmd/tins2020/tins2020_sdl.go
Normal file
13
cmd/tins2020/tins2020_sdl.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// +build !allegro
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
_ "opslag.de/schobers/zntg/sdlui" // SDL rendering backend
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
log.Println("Using SDL rendering backend")
|
||||||
|
}
|
@ -12,28 +12,38 @@ echo "Creating ${version} release"
|
|||||||
rm -rf build/linux*
|
rm -rf build/linux*
|
||||||
rm -rf build/windows*
|
rm -rf build/windows*
|
||||||
|
|
||||||
mkdir -p build/linux
|
mkdir -p build/release
|
||||||
mkdir -p build/windows
|
|
||||||
|
|
||||||
go generate ../cmd/tins2020
|
go generate ../cmd/tins2020
|
||||||
|
|
||||||
|
mkdir -p build/linux
|
||||||
go build -tags static -ldflags "-s -w" -o build/linux/botanim ../cmd/tins2020
|
go build -tags static -ldflags "-s -w" -o build/linux/botanim ../cmd/tins2020
|
||||||
cp ../README.md build/linux
|
cp ../README.md build/linux
|
||||||
|
cd build/linux
|
||||||
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -tags static -ldflags "-s -w" -o build/windows/botanim.exe ../cmd/tins2020
|
|
||||||
cp ../README.md build/windows
|
|
||||||
|
|
||||||
|
|
||||||
mkdir -p build/release
|
|
||||||
|
|
||||||
cd build
|
|
||||||
|
|
||||||
cd linux
|
|
||||||
zip -9 -q ../release/botanim_${version}_linux_amd64.zip *
|
zip -9 -q ../release/botanim_${version}_linux_amd64.zip *
|
||||||
echo "Created Linux release: build/release/botanim_${version}_linux_amd64.zip"
|
echo "Created Linux release: build/release/botanim_${version}_linux_amd64.zip"
|
||||||
cd ..
|
cd ../..
|
||||||
|
|
||||||
cd windows
|
mkdir -p build/linux-allegro
|
||||||
|
go build -tags static,allegro -ldflags "-s -w" -o build/linux-allegro/botanim ../cmd/tins2020
|
||||||
|
cp ../README.md build/linux-allegro
|
||||||
|
cd build/linux-allegro
|
||||||
|
zip -9 -q ../release/botanim_allegro_${version}_linux_amd64.zip *
|
||||||
|
echo "Created Linux (Allegro) release: build/release/botanim_allegro_${version}_linux_amd64.zip"
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
mkdir -p build/windows
|
||||||
|
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -tags static -ldflags "-s -w" -o build/windows/botanim.exe ../cmd/tins2020
|
||||||
|
cp ../README.md build/windows
|
||||||
|
cd build/windows
|
||||||
zip -9 -q ../release/botanim_${version}_windows_amd64.zip *
|
zip -9 -q ../release/botanim_${version}_windows_amd64.zip *
|
||||||
echo "Created Windows release: build/release/botanim_${version}_windows_amd64.zip"
|
echo "Created Windows release: build/release/botanim_${version}_windows_amd64.zip"
|
||||||
cd ..
|
cd ../..
|
||||||
|
|
||||||
|
mkdir -p build/windows-allegro
|
||||||
|
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -tags static,allegro,mingw64_7_3 -ldflags "-s -w" -o build/windows-allegro/botanim.exe ../cmd/tins2020
|
||||||
|
cp ../README.md build/windows-allegro
|
||||||
|
cd build/windows-allegro
|
||||||
|
zip -9 -q ../release/botanim_allegro_${version}_windows_amd64.zip *
|
||||||
|
echo "Created Windows (Allegro) release: build/release/botanim_allegro_${version}_windows_amd64.zip"
|
||||||
|
cd ../..
|
||||||
|
@ -63,12 +63,9 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case *ui.MouseButtonUpEvent:
|
case *ui.MouseButtonUpEvent:
|
||||||
pos := e.Pos()
|
if _, ok := r.drag.IsDragging(); ok {
|
||||||
if pos.In(r.interactBounds) {
|
r.game.Terrain.Center = r.isometric.TileInt(r.isometric.Center())
|
||||||
if _, ok := r.drag.IsDragging(); ok {
|
r.drag.Cancel()
|
||||||
r.game.Terrain.Center = r.isometric.TileInt(r.isometric.Center())
|
|
||||||
r.drag.Cancel()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case *ui.MouseMoveEvent:
|
case *ui.MouseMoveEvent:
|
||||||
pos := e.Pos()
|
pos := e.Pos()
|
||||||
@ -80,7 +77,7 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
|
|||||||
}
|
}
|
||||||
if _, ok := r.drag.IsDragging(); ok {
|
if _, ok := r.drag.IsDragging(); ok {
|
||||||
delta, _ := r.drag.Move(pos)
|
delta, _ := r.drag.Move(pos)
|
||||||
r.isometric.Pan(r.isometric.ViewToTileRelative(delta.Invert()))
|
r.isometric.Pan(delta.Invert())
|
||||||
}
|
}
|
||||||
if r.hover != nil {
|
if r.hover != nil {
|
||||||
if e.MouseWheel < 0 {
|
if e.MouseWheel < 0 {
|
||||||
@ -100,13 +97,13 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
|
|||||||
case ui.KeyPadMinus:
|
case ui.KeyPadMinus:
|
||||||
r.isometric.ZoomOut(r.isometric.Center())
|
r.isometric.ZoomOut(r.isometric.Center())
|
||||||
case ui.KeyW:
|
case ui.KeyW:
|
||||||
r.isometric.Pan(geom.PtF32(-1, -1))
|
r.isometric.PanTile(geom.PtF32(-1, -1))
|
||||||
case ui.KeyA:
|
case ui.KeyA:
|
||||||
r.isometric.Pan(geom.PtF32(-1, 1))
|
r.isometric.PanTile(geom.PtF32(-1, 1))
|
||||||
case ui.KeyS:
|
case ui.KeyS:
|
||||||
r.isometric.Pan(geom.PtF32(1, 1))
|
r.isometric.PanTile(geom.PtF32(1, 1))
|
||||||
case ui.KeyD:
|
case ui.KeyD:
|
||||||
r.isometric.Pan(geom.PtF32(1, -1))
|
r.isometric.PanTile(geom.PtF32(1, -1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user