White background

This commit is contained in:
2020-04-16 15:39:06 +01:00
parent 2b83ce4f7f
commit 4fe9a75d69
2 changed files with 10 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import (
"os" "os"
"github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten"
"golang.org/x/image/colornames"
"code.ur.gs/lupine/ordoor/internal/assetstore" "code.ur.gs/lupine/ordoor/internal/assetstore"
"code.ur.gs/lupine/ordoor/internal/ui" "code.ur.gs/lupine/ordoor/internal/ui"
@@ -15,7 +16,7 @@ import (
var ( var (
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation") 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") recIdx = flag.Int("record", 0, "Record index to start at")
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension") winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
@@ -53,8 +54,8 @@ func main() {
} }
state := state{ state := state{
zoom: 2.0, zoom: 6.0,
origin: image.Point{0, 0}, origin: image.Point{-300, -200}, // Show them somewhat centered
groupIdx: *groupIdx, groupIdx: *groupIdx,
recIdx: *recIdx, recIdx: *recIdx,
} }
@@ -115,8 +116,9 @@ func (e *env) Update(screenX, screenY int) error {
func (e *env) Draw(screen *ebiten.Image) error { func (e *env) Draw(screen *ebiten.Image) error {
cam := ebiten.GeoM{} 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.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 { if len(e.ani.Frames) > 0 {
sprite := e.ani.Frames[e.step/4%len(e.ani.Frames)] 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 e.state.groupIdx = 0
} }
// Reset the record if the group changes
e.state.recIdx = 0
// TODO: upper bounds checking // TODO: upper bounds checking
} }
} }

2
go.mod
View File

@@ -10,7 +10,7 @@ require (
github.com/kr/text v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // 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/mobile v0.0.0-20200329125638-4c31acba0007 // indirect
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect