diff --git a/ebitenutil/gen.go b/ebitenutil/gen.go index 00e2774d1..9cb0b1965 100644 --- a/ebitenutil/gen.go +++ b/ebitenutil/gen.go @@ -23,7 +23,7 @@ import ( "image/png" "os" - "github.com/hajimehoshi/bitmapfont/v2" + "github.com/hajimehoshi/bitmapfont/v3" "golang.org/x/image/font" "golang.org/x/image/math/fixed" ) @@ -39,9 +39,6 @@ func run() error { const ( charWidth = 6 lineHeight = 16 - - dotX = 4 - dotY = 12 ) var lines []string @@ -65,10 +62,10 @@ func run() error { Dst: dst, Src: image.NewUniform(clr), Face: bitmapfont.Face, - Dot: fixed.P(dotX+offsetX, dotY+offsetY), + Dot: fixed.Point26_6{X: fixed.I(offsetX), Y: bitmapfont.Face.Metrics().Ascent + fixed.I(offsetY)}, } for _, line := range lines { - d.Dot.X = fixed.I(dotX + offsetX) + d.Dot.X = fixed.I(offsetX) d.DrawString(line) d.Dot.Y += fixed.I(lineHeight) } diff --git a/examples/keyboard/main.go b/examples/keyboard/main.go index b6ecda4c2..67f51bc5e 100644 --- a/examples/keyboard/main.go +++ b/examples/keyboard/main.go @@ -22,7 +22,7 @@ import ( "log" "strings" - "github.com/hajimehoshi/bitmapfont/v2" + "github.com/hajimehoshi/bitmapfont/v3" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/examples/keyboard/keyboard" @@ -91,7 +91,7 @@ func (g *Game) Draw(screen *ebiten.Image) { } // Use bitmapfont.Face instead of ebitenutil.DebugPrint, since some key names might not be printed with DebugPrint. - text.Draw(screen, strings.Join(keyStrs, ", ")+"\n"+strings.Join(keyNames, ", "), bitmapfont.Face, 8, 12, color.White) + text.Draw(screen, strings.Join(keyStrs, ", ")+"\n"+strings.Join(keyNames, ", "), bitmapfont.Face, 4, 12, color.White) } func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) { diff --git a/go.mod b/go.mod index 98263f45b..2935f7db3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/ebitengine/purego v0.4.0-alpha.4 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b - github.com/hajimehoshi/bitmapfont/v2 v2.2.3 + github.com/hajimehoshi/bitmapfont/v3 v3.0.0-alpha github.com/hajimehoshi/go-mp3 v0.3.4 github.com/hajimehoshi/oto/v2 v2.5.0-alpha.0.20230315035531-31c83ff4311d github.com/jakecoffman/cp v1.2.1 diff --git a/go.sum b/go.sum index c3f828748..7eeb7da0f 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/ebitengine/purego v0.4.0-alpha.4 h1:Y7yIV06Yo5M2BAdD7EVPhfp6LZ0tEcQo5 github.com/ebitengine/purego v0.4.0-alpha.4/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/hajimehoshi/bitmapfont/v2 v2.2.3 h1:jmq/TMNj352V062Tr5e3hAoipkoxCbY1JWTzor0zNps= -github.com/hajimehoshi/bitmapfont/v2 v2.2.3/go.mod h1:sWM8ejdkGSXaQGlZcegMRx4DyEPOWYyXqsBKIs+Yhzk= +github.com/hajimehoshi/bitmapfont/v3 v3.0.0-alpha h1:qwEoAPH0PNk4InPqhRcpJUHtkmvEXtxVdVFguNBSy1M= +github.com/hajimehoshi/bitmapfont/v3 v3.0.0-alpha/go.mod h1:+CxxG+uMmgU4mI2poq944i3uZ6UYFfAkj9V6WqmuvZA= github.com/hajimehoshi/go-mp3 v0.3.4 h1:NUP7pBYH8OguP4diaTZ9wJbUbk3tC0KlfzsEpWmYj68= github.com/hajimehoshi/go-mp3 v0.3.4/go.mod h1:fRtZraRFcWb0pu7ok0LqyFhCUrPeMsGRSVop0eemFmo= github.com/hajimehoshi/oto/v2 v2.3.1/go.mod h1:seWLbgHH7AyUMYKfKYT9pg7PhUu9/SisyJvNTT+ASQo= diff --git a/text/text_test.go b/text/text_test.go index 673d0e6e8..39de86d2a 100644 --- a/text/text_test.go +++ b/text/text_test.go @@ -19,7 +19,7 @@ import ( "image/color" "testing" - "github.com/hajimehoshi/bitmapfont/v2" + "github.com/hajimehoshi/bitmapfont/v3" "golang.org/x/image/font" "golang.org/x/image/math/fixed"