Files
inkwell-demo/lib/widget.savekeys.go
mr.zeroandClaude Opus 5 d2daa3f02a
ci/woodpecker/push/ebitengine Pipeline was successful
ci/woodpecker/manual/ebitengine Pipeline was successful
Consume the published inkwell module instead of a sibling checkout
inkwell is now released as engines/inkwell v0.1.0, so the `replace
=> ../inkwell` directive can go. That directive is why this pipeline
was failing: it requires a sibling working copy that only exists on a
developer's machine, never in a CI checkout.

Module paths follow the org move as well — this repo is demos/, inkwell
is engines/ — since Gitea's redirect does not apply to Go module paths.

GOPRIVATE is exported from the Makefile: our own modules are not on
proxy.golang.org and not in the public checksum database.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 10:35:01 +02:00

36 lines
884 B
Go

package lib
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
p "git.teletypegames.org/engines/inkwell"
)
// SaveKeys is a no-draw widget that binds F5 → Save(slot 0) and
// F9 → Load(slot 0). Errors are surfaced via FlashLine so the player
// sees them in the status strip.
type SaveKeys struct{}
func (s *SaveKeys) GetName() string { return "save_keys" }
func (s *SaveKeys) Tick(ctx *p.UICtx) {
g := ctx.Game
if inpututil.IsKeyJustPressed(ebiten.KeyF5) {
if err := g.Save(0); err != nil {
g.FlashLine("Mentés hiba: " + err.Error())
} else {
g.FlashLine("Mentve (F5).")
}
}
if inpututil.IsKeyJustPressed(ebiten.KeyF9) {
if err := g.Load(0); err != nil {
g.FlashLine("Töltés hiba: " + err.Error())
} else {
g.FlashLine("Betöltve (F9).")
}
}
}
func (s *SaveKeys) Draw(_ *ebiten.Image, _ *p.UICtx) {}