Compare commits
9 Commits
botanim_1_
...
master
Author | SHA1 | Date | |
---|---|---|---|
d0e6721953 | |||
1ae7e9ebe4 | |||
8264942602 | |||
6ce7baed2b | |||
bd1d685c20 | |||
93002a784b | |||
7230ac966b | |||
62cbe14170 | |||
df97e826c8 |
@ -124,6 +124,8 @@ 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).
|
||||
|
||||
## 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
|
||||
Can be found at https://opslag.de/schobers/tins2020 (Git repository).
|
||||
|
@ -5,15 +5,13 @@ import (
|
||||
"image/color"
|
||||
"log"
|
||||
|
||||
"opslag.de/schobers/fs/ricefs"
|
||||
"opslag.de/schobers/geom"
|
||||
"opslag.de/schobers/zntg"
|
||||
"opslag.de/schobers/zntg/addons/res"
|
||||
"opslag.de/schobers/zntg/addons/riceres"
|
||||
"opslag.de/schobers/zntg/play"
|
||||
"opslag.de/schobers/zntg/ui"
|
||||
|
||||
rice "github.com/GeertJohan/go.rice"
|
||||
"github.com/veandco/go-sdl2/sdl"
|
||||
"opslag.de/schobers/tins2020"
|
||||
)
|
||||
|
||||
@ -28,9 +26,8 @@ func main() {
|
||||
}
|
||||
|
||||
func openResources(box *rice.Box) ui.Resources {
|
||||
fs := ricefs.NewFs(box)
|
||||
resources, _ := res.NewAferoFallbackResources(`res`, fs, `botanim`)
|
||||
return resources
|
||||
embedded := riceres.New(box)
|
||||
return ui.NewFallbackResources(ui.NewPathResources(nil, box.Name()), embedded)
|
||||
}
|
||||
|
||||
type app struct {
|
||||
@ -137,8 +134,9 @@ func run() error {
|
||||
}
|
||||
defer settings.Store()
|
||||
|
||||
if settings.Window.Location == nil {
|
||||
settings.Window.Location = ptPtr(sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED)
|
||||
var location *geom.PointF32
|
||||
if settings.Window.Location != nil {
|
||||
location = &geom.PointF32{X: float32(settings.Window.Location.X), Y: float32(settings.Window.Location.Y)}
|
||||
}
|
||||
if settings.Window.Size == nil {
|
||||
settings.Window.Size = ptPtr(800, 600)
|
||||
@ -148,7 +146,7 @@ func run() error {
|
||||
settings.Window.VSync = &vsync
|
||||
}
|
||||
renderer, err := ui.NewRenderer("Botanim - TINS 2020", settings.Window.Size.X, settings.Window.Size.Y, ui.NewRendererOptions{
|
||||
Location: &geom.PointF32{X: float32(settings.Window.Location.X), Y: float32(settings.Window.Location.Y)},
|
||||
Location: location,
|
||||
Resizable: true,
|
||||
VSync: *settings.Window.VSync,
|
||||
})
|
||||
|
@ -8,6 +8,9 @@ import (
|
||||
_ "opslag.de/schobers/zntg/allg5ui" // rendering backend
|
||||
)
|
||||
|
||||
// #cgo windows,allegro LDFLAGS: -Wl,-subsystem,windows
|
||||
import "C"
|
||||
|
||||
func init() {
|
||||
log.Println("Using Allegro5 rendering backend")
|
||||
}
|
||||
|
@ -107,16 +107,16 @@ func (c *GameControls) Init(ctx ui.Context) {
|
||||
b.DisabledColor = zntg.MustHexColor("#AFAFAF")
|
||||
}),
|
||||
NewIconButtonConfigure("control-save", c.askUserBeforeSave, func(b *IconButton) {
|
||||
b.Tooltip = "Save game"
|
||||
b.Tooltip = "Save game (key: Ctrl+S)"
|
||||
}),
|
||||
NewIconButtonConfigure("control-load", c.askUserBeforeLoad, func(b *IconButton) {
|
||||
b.Tooltip = "Load last saved game"
|
||||
b.Tooltip = "Load last saved game (key: Ctrl+L)"
|
||||
}),
|
||||
NewIconButtonConfigure("control-new", c.askUserBeforeNew, func(b *IconButton) {
|
||||
b.Tooltip = "Start new game"
|
||||
b.Tooltip = "Start new game (key: Ctrl+N)"
|
||||
}),
|
||||
NewIconButtonConfigure("control-information", c.dialogs.ShowIntro, func(b *IconButton) {
|
||||
b.Tooltip = "Show information/intro"
|
||||
b.Tooltip = "Show information/intro (key: Escape)"
|
||||
}),
|
||||
}
|
||||
for i, child := range c.menu.Children {
|
||||
|
@ -66,7 +66,7 @@ type LargeDialogTitleBar struct {
|
||||
ui.ContainerBase
|
||||
|
||||
title ui.Label
|
||||
close IconButton
|
||||
close ui.Button
|
||||
}
|
||||
|
||||
func NewLargeDialogTitleBar(title string, closeRequested ui.EventFn) *LargeDialogTitleBar {
|
||||
|
43
resources.go
43
resources.go
@ -1,43 +0,0 @@
|
||||
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,9 +7,12 @@ else
|
||||
version="$1"
|
||||
fi
|
||||
|
||||
version_safe=${version//\./_}
|
||||
|
||||
echo "Creating ${version} release"
|
||||
|
||||
rm -rf build/linux*
|
||||
rm -rf build/macosx*
|
||||
rm -rf build/windows*
|
||||
|
||||
mkdir -p build/release
|
||||
@ -20,30 +23,38 @@ mkdir -p build/linux
|
||||
go build -tags static -ldflags "-s -w" -o build/linux/botanim ../cmd/tins2020
|
||||
cp ../README.md build/linux
|
||||
cd build/linux
|
||||
zip -9 -q ../release/botanim_${version}_linux_amd64.zip *
|
||||
echo "Created Linux release: build/release/botanim_${version}_linux_amd64.zip"
|
||||
zip -9 -q ../release/botanim_${version_safe}_linux_amd64.zip *
|
||||
echo "Created Linux release: build/release/botanim_${version_safe}_linux_amd64.zip"
|
||||
cd ../..
|
||||
|
||||
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"
|
||||
zip -9 -q ../release/botanim_allegro_${version_safe}_linux_amd64.zip *
|
||||
echo "Created Linux (Allegro) release: build/release/botanim_allegro_${version_safe}_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 ../..
|
||||
|
||||
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 *
|
||||
echo "Created Windows release: build/release/botanim_${version}_windows_amd64.zip"
|
||||
zip -9 -q ../release/botanim_${version_safe}_windows_amd64.zip *
|
||||
echo "Created Windows release: build/release/botanim_${version_safe}_windows_amd64.zip"
|
||||
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"
|
||||
zip -9 -q ../release/botanim_allegro_${version_safe}_windows_amd64.zip *
|
||||
echo "Created Windows (Allegro) release: build/release/botanim_allegro_${version_safe}_windows_amd64.zip"
|
||||
cd ../..
|
||||
|
Loading…
Reference in New Issue
Block a user