rename to Constructor to Konstructor

This commit is contained in:
2023-06-30 17:48:34 +02:00
parent 0ed8cfb839
commit c07074aeb9
5 changed files with 20 additions and 20 deletions

32
konstructor/utils.go Executable file
View File

@@ -0,0 +1,32 @@
package konstructor
import (
"bytes"
"image"
"io/ioutil"
"log"
_ "image/png"
"github.com/hajimehoshi/ebiten"
)
func LoadImage(path string) *ebiten.Image {
file, err := ioutil.ReadFile(path) //read the content of file
if err != nil {
log.Fatal(err)
}
img, _, err := image.Decode(bytes.NewReader(file))
if err != nil {
log.Fatal(err)
}
out, err := ebiten.NewImageFromImage(img, 0)
if err != nil {
log.Fatal(err)
}
return out
}