Compare commits

...

3 Commits

Author SHA1 Message Date
bd1d685c20 Hid console window for Windows Allegro builds.
Removed explicit SDL dependency in game.
2020-05-25 22:54:58 +02:00
93002a784b Added hints on keyboard shortcuts. 2020-05-25 22:26:08 +02:00
7230ac966b Using the refactored Resources system. 2020-05-25 22:24:58 +02:00
3 changed files with 17 additions and 13 deletions

View File

@ -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,
})

View File

@ -0,0 +1,6 @@
// +build windows,allegro
package main
// #cgo LDFLAGS: -Wl,-subsystem,windows
import "C"

View File

@ -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 {