ebitenutil: use go:embed

Updates #1258
This commit is contained in:
Hajime Hoshi 2022-09-15 23:25:21 +09:00
parent 289129c9e5
commit 3cafb0f6fd
2 changed files with 5 additions and 7 deletions

View File

@ -13,25 +13,28 @@
// limitations under the License.
//go:generate go run gen.go
//go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice@v1.0.0 -input text.png -output text.png.go -package ebitenutil -var textPng
package ebitenutil
import (
"bytes"
_ "embed"
"image"
_ "image/png"
"github.com/hajimehoshi/ebiten/v2"
)
//go:embed text.png
var text_png []byte
var (
debugPrintTextImage *ebiten.Image
debugPrintTextSubImages = map[rune]*ebiten.Image{}
)
func init() {
img, _, err := image.Decode(bytes.NewReader(textPng))
img, _, err := image.Decode(bytes.NewReader(text_png))
if err != nil {
panic(err)
}

File diff suppressed because one or more lines are too long