Incorporating flask element.

This commit is contained in:
2025-12-06 15:26:25 -05:00
parent a15c89d769
commit 45b286b66e
6 changed files with 298 additions and 4 deletions

41
resources/images.go Normal file
View File

@@ -0,0 +1,41 @@
package resources
import (
"bytes"
"image"
"log"
_ "embed"
"github.com/hajimehoshi/ebiten/v2"
)
type ImageName string
const (
RoundedBottomFlaskBase ImageName = "RoundedBottomFlaskBase"
RoundedBottomFlaskHighlights ImageName = "RoundedBottomFlaskHighlights"
)
var (
ImageBank map[ImageName]*ebiten.Image
//go:embed rounded_bottom_flask_base.png
rounded_bottom_flask_base []byte
//go:embed rounded_bottom_flask_highlights.png
rounded_bottom_flask_highlitsh []byte
)
func LoadImages() {
ImageBank = make(map[ImageName]*ebiten.Image)
ImageBank[RoundedBottomFlaskBase] = LoadImagesFatal(rounded_bottom_flask_base)
ImageBank[RoundedBottomFlaskHighlights] = LoadImagesFatal(rounded_bottom_flask_highlitsh)
}
func LoadImagesFatal(b []byte) *ebiten.Image {
img, _, err := image.Decode(bytes.NewReader(b))
if err != nil {
log.Fatal(err)
}
return ebiten.NewImageFromImage(img)
}