aboutsummaryrefslogtreecommitdiff
path: root/go/assets
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-19 15:32:17 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:40 +0200
commitedf89db6fc28931ca59f6c9acfd0a561d68145c7 (patch)
treefe2961223279d16f5d9952f2e9d4aa6d1a5fcf66 /go/assets
parent97a80cc2cf2a5b5a8334fc42f65863651516d4cf (diff)
downloadmuhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.tar.gz
muhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.zip
add discard2 icon and button to trigger the free action
Diffstat (limited to 'go/assets')
-rw-r--r--go/assets/.gitignore1
-rw-r--r--go/assets/icons.go25
2 files changed, 26 insertions, 0 deletions
diff --git a/go/assets/.gitignore b/go/assets/.gitignore
new file mode 100644
index 00000000..f312659d
--- /dev/null
+++ b/go/assets/.gitignore
@@ -0,0 +1 @@
+copy/ \ No newline at end of file
diff --git a/go/assets/icons.go b/go/assets/icons.go
new file mode 100644
index 00000000..6e461045
--- /dev/null
+++ b/go/assets/icons.go
@@ -0,0 +1,25 @@
+package assets
+
+import (
+ "bytes"
+ "embed"
+ "image"
+ _ "image/png"
+ "log"
+)
+
+//go:embed copy/icons/*
+var icons embed.FS
+
+// GetIcon returns a usable [image.Image] for an embeded icon by its name.
+func GetIcon(name string) image.Image {
+ iconData, err := icons.ReadFile("copy/icons/" + name)
+ if err != nil {
+ log.Panic(err)
+ }
+ icon, _, err := image.Decode(bytes.NewReader(iconData))
+ if err != nil {
+ log.Panic(err)
+ }
+ return icon
+}