Skip to content

Commit

Permalink
Merge pull request #3 from MatusOllah/error-handling
Browse files Browse the repository at this point in the history
Make error handling consistent
  • Loading branch information
temidaradev authored Jan 4, 2025
2 parents 61c0da5 + 4e51302 commit b835de9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions esset.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"image/color"
_ "image/png"
"io/fs"
"log"

"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/text/v2"
Expand All @@ -16,12 +15,12 @@ import (
func GetAsset(efs embed.FS, path string) *ebiten.Image {
file, err := efs.Open(path)
if err != nil {
log.Fatal(err)
panic(err)
}

img, _, err := image.Decode(file)
if err != nil {
log.Fatal(err)
panic(err)
}

return ebiten.NewImageFromImage(img)
Expand All @@ -48,7 +47,7 @@ var (
func DrawText(screen *ebiten.Image, data []byte, str string, fontSize int, posX, posY float64, color color.Color) {
s, err := text.NewGoTextFaceSource(bytes.NewReader(data))
if err != nil {
log.Fatal(err)
panic(err)
}
fontFaceSource = s

Expand Down

0 comments on commit b835de9

Please sign in to comment.