Compare commits
No commits in common. "a139b87d58bc9aca4542e428e8bf7a792f44908b" and "ad7c149baf5008d9b08d73257be29cd8ff6d3fd9" have entirely different histories.
a139b87d58
...
ad7c149baf
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
|
|
||||||
cmd/tins2020/*rice-box.*
|
cmd/tins2020/*rice-box.*
|
||||||
scripts/build
|
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
|
||||||
)
|
|
||||||
|
|
||||||
func copyFile(path string, file *rice.File) error {
|
|
||||||
dir := filepath.Dir(path)
|
|
||||||
os.MkdirAll(dir, 0777)
|
|
||||||
dst, err := os.Create(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer dst.Close()
|
|
||||||
_, err = io.Copy(dst, file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func copyBoxToDisk(box *rice.Box) error {
|
|
||||||
return box.Walk("", func(path string, info os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if info.IsDir() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
src, err := box.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return copyFile(filepath.Join(box.Name(), path), src)
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
rice "github.com/GeertJohan/go.rice"
|
||||||
@ -27,20 +26,6 @@ func logSDLVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
var extract bool
|
|
||||||
flag.BoolVar(&extract, "extract-resources", false, "extracts all resources to the current working directory")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
ctx, err := tins2020.NewContext(rice.MustFindBox("res"))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer ctx.Destroy()
|
|
||||||
|
|
||||||
if extract {
|
|
||||||
return copyBoxToDisk(ctx.Resources.Box())
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
|
if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -53,6 +38,12 @@ func run() error {
|
|||||||
}
|
}
|
||||||
defer ttf.Quit()
|
defer ttf.Quit()
|
||||||
|
|
||||||
|
ctx, err := tins2020.NewContext(rice.MustFindBox("res"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer ctx.Destroy()
|
||||||
|
|
||||||
if ctx.Settings.Window.Location == nil {
|
if ctx.Settings.Window.Location == nil {
|
||||||
ctx.Settings.Window.Location = tins2020.PtPtr(sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED)
|
ctx.Settings.Window.Location = tins2020.PtPtr(sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED)
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,6 @@ type Resources struct {
|
|||||||
copy vfs.CopyDir
|
copy vfs.CopyDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resources) Box() *rice.Box {
|
|
||||||
return r.box
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Resources) Destroy() {
|
func (r *Resources) Destroy() {
|
||||||
r.copy.Destroy()
|
r.copy.Destroy()
|
||||||
}
|
}
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
version="0.0.0"
|
|
||||||
else
|
|
||||||
version="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Creating ${version} release"
|
|
||||||
|
|
||||||
rm -rf build/linux*
|
|
||||||
rm -rf build/windows*
|
|
||||||
|
|
||||||
mkdir -p build/linux
|
|
||||||
mkdir -p build/windows
|
|
||||||
|
|
||||||
go generate ../cmd/tins2020
|
|
||||||
|
|
||||||
go build -tags static -ldflags "-s -w" -o build/linux/botanim ../cmd/tins2020
|
|
||||||
cp ../README.md 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 *
|
|
||||||
echo "Created Linux release: build/release/botanim_${version}_linux_amd64.zip"
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd windows
|
|
||||||
zip -9 -q ../release/botanim_${version}_windows_amd64.zip *
|
|
||||||
echo "Created Windows release: build/release/botanim_${version}_windows_amd64.zip"
|
|
||||||
cd ..
|
|
Loading…
Reference in New Issue
Block a user