Compare commits
No commits in common. "master" and "botanim_1_0_1" have entirely different histories.
master
...
botanim_1_
@ -124,8 +124,6 @@ go install opslag.de/schobers/tins2020/cmd/tins2020 -tags static,allegro -ldflag
|
|||||||
```
|
```
|
||||||
In this case the SDL 2.0 prerequisite is replaced by the Allegro 5.2 (development libraries must be available for your C compiler).
|
In this case the SDL 2.0 prerequisite is replaced by the Allegro 5.2 (development libraries must be available for your C compiler).
|
||||||
|
|
||||||
## Command line interface
|
|
||||||
You can extract all resources embedded in the executable by running it from the command line with the `--extract-resources` flag. The resources will be extract in the current working directory. Note that the game will use the resources on disk first if they are available.
|
|
||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
Can be found at https://opslag.de/schobers/tins2020 (Git repository).
|
Can be found at https://opslag.de/schobers/tins2020 (Git repository).
|
||||||
|
@ -5,13 +5,15 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"opslag.de/schobers/fs/ricefs"
|
||||||
"opslag.de/schobers/geom"
|
"opslag.de/schobers/geom"
|
||||||
"opslag.de/schobers/zntg"
|
"opslag.de/schobers/zntg"
|
||||||
"opslag.de/schobers/zntg/addons/riceres"
|
"opslag.de/schobers/zntg/addons/res"
|
||||||
"opslag.de/schobers/zntg/play"
|
"opslag.de/schobers/zntg/play"
|
||||||
"opslag.de/schobers/zntg/ui"
|
"opslag.de/schobers/zntg/ui"
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
rice "github.com/GeertJohan/go.rice"
|
||||||
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
"opslag.de/schobers/tins2020"
|
"opslag.de/schobers/tins2020"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,8 +28,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func openResources(box *rice.Box) ui.Resources {
|
func openResources(box *rice.Box) ui.Resources {
|
||||||
embedded := riceres.New(box)
|
fs := ricefs.NewFs(box)
|
||||||
return ui.NewFallbackResources(ui.NewPathResources(nil, box.Name()), embedded)
|
resources, _ := res.NewAferoFallbackResources(`res`, fs, `botanim`)
|
||||||
|
return resources
|
||||||
}
|
}
|
||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
@ -134,9 +137,8 @@ func run() error {
|
|||||||
}
|
}
|
||||||
defer settings.Store()
|
defer settings.Store()
|
||||||
|
|
||||||
var location *geom.PointF32
|
if settings.Window.Location == nil {
|
||||||
if settings.Window.Location != nil {
|
settings.Window.Location = ptPtr(sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED)
|
||||||
location = &geom.PointF32{X: float32(settings.Window.Location.X), Y: float32(settings.Window.Location.Y)}
|
|
||||||
}
|
}
|
||||||
if settings.Window.Size == nil {
|
if settings.Window.Size == nil {
|
||||||
settings.Window.Size = ptPtr(800, 600)
|
settings.Window.Size = ptPtr(800, 600)
|
||||||
@ -146,7 +148,7 @@ func run() error {
|
|||||||
settings.Window.VSync = &vsync
|
settings.Window.VSync = &vsync
|
||||||
}
|
}
|
||||||
renderer, err := ui.NewRenderer("Botanim - TINS 2020", settings.Window.Size.X, settings.Window.Size.Y, ui.NewRendererOptions{
|
renderer, err := ui.NewRenderer("Botanim - TINS 2020", settings.Window.Size.X, settings.Window.Size.Y, ui.NewRendererOptions{
|
||||||
Location: location,
|
Location: &geom.PointF32{X: float32(settings.Window.Location.X), Y: float32(settings.Window.Location.Y)},
|
||||||
Resizable: true,
|
Resizable: true,
|
||||||
VSync: *settings.Window.VSync,
|
VSync: *settings.Window.VSync,
|
||||||
})
|
})
|
||||||
|
@ -8,9 +8,6 @@ import (
|
|||||||
_ "opslag.de/schobers/zntg/allg5ui" // rendering backend
|
_ "opslag.de/schobers/zntg/allg5ui" // rendering backend
|
||||||
)
|
)
|
||||||
|
|
||||||
// #cgo windows,allegro LDFLAGS: -Wl,-subsystem,windows
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.Println("Using Allegro5 rendering backend")
|
log.Println("Using Allegro5 rendering backend")
|
||||||
}
|
}
|
||||||
|
@ -107,16 +107,16 @@ func (c *GameControls) Init(ctx ui.Context) {
|
|||||||
b.DisabledColor = zntg.MustHexColor("#AFAFAF")
|
b.DisabledColor = zntg.MustHexColor("#AFAFAF")
|
||||||
}),
|
}),
|
||||||
NewIconButtonConfigure("control-save", c.askUserBeforeSave, func(b *IconButton) {
|
NewIconButtonConfigure("control-save", c.askUserBeforeSave, func(b *IconButton) {
|
||||||
b.Tooltip = "Save game (key: Ctrl+S)"
|
b.Tooltip = "Save game"
|
||||||
}),
|
}),
|
||||||
NewIconButtonConfigure("control-load", c.askUserBeforeLoad, func(b *IconButton) {
|
NewIconButtonConfigure("control-load", c.askUserBeforeLoad, func(b *IconButton) {
|
||||||
b.Tooltip = "Load last saved game (key: Ctrl+L)"
|
b.Tooltip = "Load last saved game"
|
||||||
}),
|
}),
|
||||||
NewIconButtonConfigure("control-new", c.askUserBeforeNew, func(b *IconButton) {
|
NewIconButtonConfigure("control-new", c.askUserBeforeNew, func(b *IconButton) {
|
||||||
b.Tooltip = "Start new game (key: Ctrl+N)"
|
b.Tooltip = "Start new game"
|
||||||
}),
|
}),
|
||||||
NewIconButtonConfigure("control-information", c.dialogs.ShowIntro, func(b *IconButton) {
|
NewIconButtonConfigure("control-information", c.dialogs.ShowIntro, func(b *IconButton) {
|
||||||
b.Tooltip = "Show information/intro (key: Escape)"
|
b.Tooltip = "Show information/intro"
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
for i, child := range c.menu.Children {
|
for i, child := range c.menu.Children {
|
||||||
|
@ -66,7 +66,7 @@ type LargeDialogTitleBar struct {
|
|||||||
ui.ContainerBase
|
ui.ContainerBase
|
||||||
|
|
||||||
title ui.Label
|
title ui.Label
|
||||||
close ui.Button
|
close IconButton
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLargeDialogTitleBar(title string, closeRequested ui.EventFn) *LargeDialogTitleBar {
|
func NewLargeDialogTitleBar(title string, closeRequested ui.EventFn) *LargeDialogTitleBar {
|
||||||
|
43
resources.go
Normal file
43
resources.go
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package tins2020
|
||||||
|
|
||||||
|
import (
|
||||||
|
rice "github.com/GeertJohan/go.rice"
|
||||||
|
"github.com/spf13/afero"
|
||||||
|
"opslag.de/schobers/fs/ricefs"
|
||||||
|
"opslag.de/schobers/fs/vfs"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Resources struct {
|
||||||
|
box *rice.Box
|
||||||
|
fs afero.Fs
|
||||||
|
copy vfs.CopyDir
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Resources) Box() *rice.Box {
|
||||||
|
return r.box
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Resources) Destroy() {
|
||||||
|
r.copy.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Resources) Fs() afero.Fs {
|
||||||
|
return r.fs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Resources) Open(box *rice.Box) error {
|
||||||
|
r.box = box
|
||||||
|
r.fs = vfs.NewOsFsFallback(r.box.Name(), ricefs.NewFs(box))
|
||||||
|
copy, err := vfs.NewCopyDir(r.fs)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
r.copy = copy
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Resources) Copy() vfs.CopyDir { return r.copy }
|
||||||
|
|
||||||
|
func (r *Resources) Retrieve(name string) (string, error) {
|
||||||
|
return r.copy.Retrieve(name)
|
||||||
|
}
|
@ -7,12 +7,9 @@ else
|
|||||||
version="$1"
|
version="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version_safe=${version//\./_}
|
|
||||||
|
|
||||||
echo "Creating ${version} release"
|
echo "Creating ${version} release"
|
||||||
|
|
||||||
rm -rf build/linux*
|
rm -rf build/linux*
|
||||||
rm -rf build/macosx*
|
|
||||||
rm -rf build/windows*
|
rm -rf build/windows*
|
||||||
|
|
||||||
mkdir -p build/release
|
mkdir -p build/release
|
||||||
@ -23,38 +20,30 @@ 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
|
cd build/linux
|
||||||
zip -9 -q ../release/botanim_${version_safe}_linux_amd64.zip *
|
zip -9 -q ../release/botanim_${version}_linux_amd64.zip *
|
||||||
echo "Created Linux release: build/release/botanim_${version_safe}_linux_amd64.zip"
|
echo "Created Linux release: build/release/botanim_${version}_linux_amd64.zip"
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
mkdir -p build/linux-allegro
|
mkdir -p build/linux-allegro
|
||||||
go build -tags static,allegro -ldflags "-s -w" -o build/linux-allegro/botanim ../cmd/tins2020
|
go build -tags static,allegro -ldflags "-s -w" -o build/linux-allegro/botanim ../cmd/tins2020
|
||||||
cp ../README.md build/linux-allegro
|
cp ../README.md build/linux-allegro
|
||||||
cd build/linux-allegro
|
cd build/linux-allegro
|
||||||
zip -9 -q ../release/botanim_allegro_${version_safe}_linux_amd64.zip *
|
zip -9 -q ../release/botanim_allegro_${version}_linux_amd64.zip *
|
||||||
echo "Created Linux (Allegro) release: build/release/botanim_allegro_${version_safe}_linux_amd64.zip"
|
echo "Created Linux (Allegro) release: build/release/botanim_allegro_${version}_linux_amd64.zip"
|
||||||
cd ../..
|
|
||||||
|
|
||||||
mkdir -p build/macosx
|
|
||||||
CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -tags static -ldflags "-s -w" -o build/macosx/botanim ../cmd/tins2020
|
|
||||||
cp ../README.md build/macosx
|
|
||||||
cd build/macosx
|
|
||||||
zip -9 -q ../release/botanim_${version_safe}_macosx_amd64.zip *
|
|
||||||
echo "Created Mac OS X release: build/release/botanim_${version_safe}_macosx_amd64.zip"
|
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
mkdir -p build/windows
|
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
|
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
|
cp ../README.md build/windows
|
||||||
cd build/windows
|
cd build/windows
|
||||||
zip -9 -q ../release/botanim_${version_safe}_windows_amd64.zip *
|
zip -9 -q ../release/botanim_${version}_windows_amd64.zip *
|
||||||
echo "Created Windows release: build/release/botanim_${version_safe}_windows_amd64.zip"
|
echo "Created Windows release: build/release/botanim_${version}_windows_amd64.zip"
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
mkdir -p build/windows-allegro
|
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
|
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
|
cp ../README.md build/windows-allegro
|
||||||
cd build/windows-allegro
|
cd build/windows-allegro
|
||||||
zip -9 -q ../release/botanim_allegro_${version_safe}_windows_amd64.zip *
|
zip -9 -q ../release/botanim_allegro_${version}_windows_amd64.zip *
|
||||||
echo "Created Windows (Allegro) release: build/release/botanim_allegro_${version_safe}_windows_amd64.zip"
|
echo "Created Windows (Allegro) release: build/release/botanim_allegro_${version}_windows_amd64.zip"
|
||||||
cd ../..
|
cd ../..
|
||||||
|
Loading…
Reference in New Issue
Block a user