Skip to content

Commit b1aea86

Browse files
author
Kalle Fagerberg
committed
Upgrade firefly-go SDK
1 parent 2fd9e5c commit b1aea86

7 files changed

Lines changed: 10 additions & 201 deletions

File tree

assets/assets.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
var (
12-
buf [1036376]byte
12+
buf [1366914]byte
1313

1414
Field firefly.Image
1515
FireflyHighlight util.SpriteSheet
@@ -23,7 +23,7 @@ var (
2323
RacingMapTrees firefly.Image
2424
RacingMapTreetops firefly.Image
2525
RacingMapClouds util.SpriteSheet
26-
RacingMapMask util.ExtImage
26+
RacingMapMask firefly.Image
2727
RacingPlace util.SpriteSheet
2828
VictorySplash util.SpriteSheet
2929
DefeatSplash util.SpriteSheet
@@ -71,7 +71,7 @@ func Load() {
7171
RacingMapTrees = loader.LoadImage("racing-map-trees")
7272
RacingMapTreetops = loader.LoadImage("racing-map-treetops")
7373
RacingMapClouds = util.SplitImageByCount(loader.LoadImage("racing-map-clouds"), firefly.S(2, 1))
74-
RacingMapMask = loader.LoadExtImage("racing-map-mask")
74+
RacingMapMask = loader.LoadImage("racing-map-mask")
7575
RacingPlace = util.SplitImageBySize(loader.LoadImage("racing-place"), firefly.S(28, 33))
7676
VictorySplash = util.SplitImageByCount(loader.LoadImage("victory-splash"), firefly.S(3, 3))
7777
DefeatSplash = util.SplitImageByCount(loader.LoadImage("defeat-splash"), firefly.S(3, 3))
@@ -105,7 +105,7 @@ func (loader *Loader) LoadFile(path string) firefly.File {
105105
// https://github.com/firefly-zero/firefly-runtime/issues/7
106106
fileSize := firefly.GetFileSize(path)
107107
file := firefly.LoadFile(path, loader.buf[:fileSize])
108-
written := len(file.Raw)
108+
written := len(file.Bytes())
109109
loader.used += written
110110
loader.buf = loader.buf[written:]
111111
return file
@@ -115,10 +115,6 @@ func (loader *Loader) LoadImage(path string) firefly.Image {
115115
return loader.LoadFile(path).Image()
116116
}
117117

118-
func (loader *Loader) LoadExtImage(path string) util.ExtImage {
119-
return util.NewExtImage(loader.LoadFile(path))
120-
}
121-
122118
func (loader *Loader) LoadFont(path string) firefly.Font {
123119
return loader.LoadFile(path).Font()
124120
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ go 1.25.5
44

55
require (
66
github.com/applejag/firefly-go-math v0.2.0
7-
github.com/firefly-zero/firefly-go v0.10.0
7+
github.com/firefly-zero/firefly-go v0.11.0
88
github.com/orsinium-labs/tinymath v1.1.0
99
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
github.com/applejag/firefly-go-math v0.2.0 h1:IiDXTbHpLDU8LR8LP3RKGpyUA59mQp2HwAdkDyLLask=
22
github.com/applejag/firefly-go-math v0.2.0/go.mod h1:XbmMPAO9vDIYvwAJIPlY6HE0m1RZ3tXgn3GP9agFXos=
3-
github.com/firefly-zero/firefly-go v0.10.0 h1:CFEVPrXdLCZYgMna2DMncZ+lR01xg3danlXtIw+dJkE=
4-
github.com/firefly-zero/firefly-go v0.10.0/go.mod h1:+X/XGyPdES51OESkV8NSf1mszEBZionoROM7x2pBofw=
3+
github.com/firefly-zero/firefly-go v0.11.0 h1:+Y5EE0sXxjylZo9H3U3+VpPU1bCXdq0q7xnrpn207pg=
4+
github.com/firefly-zero/firefly-go v0.11.0/go.mod h1:osit9/kxcqSUBVozePb7LNzOHy3FQ7ii1Z0mL82pWu0=
55
github.com/orsinium-labs/tinymath v1.1.0 h1:KomdsyLHB7vE3f1nRAJF2dyf1m/gnM2HxfTeV1vS5UA=
66
github.com/orsinium-labs/tinymath v1.1.0/go.mod h1:WPXX6ei3KSXG7JfA03a+ekCYaY9SWN4I+JRl2p6ck+A=

pkg/scenes/racebattle/player.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (f *Firefly) Move(to ffmath.Vec) {
119119
}
120120
for delta.RadiusSquared() > 0.01 {
121121
to = f.Pos.Add(delta)
122-
switch assets.RacingMapMask.GetColorAt(to.Point()) {
122+
switch assets.RacingMapMask.GetPixel(to.Point()) {
123123
case firefly.ColorWhite:
124124
f.Pos = to
125125
return

pkg/state/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ func (g *GameState) LoadSave() bool {
9797
return false
9898
}
9999
g.Reset()
100-
if err := g.UnmarshalBinary(file.Raw); err != nil {
100+
if err := g.UnmarshalBinary(file); err != nil {
101101
firefly.LogError("failed to load save: " + err.Error())
102102
return false
103103
}
104104

105-
firefly.LogDebug("loaded saved game, size: " + strconv.Itoa(len(file.Raw)) + " B")
105+
firefly.LogDebug("loaded saved game, size: " + strconv.Itoa(len(file)) + " B")
106106
return true
107107
}
108108

pkg/util/image.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

pkg/util/image_test.go

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)