From 4fe9a75d69c9534e6bc68de8cf028faa3f346347 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 16 Apr 2020 15:39:06 +0100 Subject: [PATCH] White background --- cmd/view-ani/main.go | 13 +++++++++---- go.mod | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/view-ani/main.go b/cmd/view-ani/main.go index 6b86cf7..1e37ec1 100644 --- a/cmd/view-ani/main.go +++ b/cmd/view-ani/main.go @@ -8,6 +8,7 @@ import ( "os" "github.com/hajimehoshi/ebiten" + "golang.org/x/image/colornames" "code.ur.gs/lupine/ordoor/internal/assetstore" "code.ur.gs/lupine/ordoor/internal/ui" @@ -15,7 +16,7 @@ import ( var ( gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation") - groupIdx = flag.Int("group", 0, "Group index to start at") + groupIdx = flag.Int("group", 1, "Group index to start at") recIdx = flag.Int("record", 0, "Record index to start at") winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension") @@ -53,8 +54,8 @@ func main() { } state := state{ - zoom: 2.0, - origin: image.Point{0, 0}, + zoom: 6.0, + origin: image.Point{-300, -200}, // Show them somewhat centered groupIdx: *groupIdx, recIdx: *recIdx, } @@ -115,8 +116,9 @@ func (e *env) Update(screenX, screenY int) error { func (e *env) Draw(screen *ebiten.Image) error { cam := ebiten.GeoM{} - cam.Translate(float64(-e.state.origin.X), float64(-e.state.origin.Y)) // Move to origin cam.Scale(e.state.zoom, e.state.zoom) // apply current zoom factor + cam.Translate(float64(-e.state.origin.X), float64(-e.state.origin.Y)) // Move to origin + screen.Fill(colornames.White) if len(e.ani.Frames) > 0 { sprite := e.ani.Frames[e.step/4%len(e.ani.Frames)] @@ -135,6 +137,9 @@ func (e *env) changeGroup(by int) func() { e.state.groupIdx = 0 } + // Reset the record if the group changes + e.state.recIdx = 0 + // TODO: upper bounds checking } } diff --git a/go.mod b/go.mod index 0d9f7b2..32fc1f0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect - golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect + golang.org/x/image v0.0.0-20200119044424-58c23975cae1 golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007 // indirect golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect