aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 09:20:29 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 09:20:29 +0200
commit987aa73f11f4c5fbc7136313c77aaad42e7e9edd (patch)
tree2108951ec23042c962ef243834a47ac7766e30cd /main.go
parent0735888213d8575cf870f22d4d905af3f3c1ac9b (diff)
feat: Add window icon
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.go b/main.go
index f61c9c8..76bb259 100644
--- a/main.go
+++ b/main.go
@@ -1,7 +1,9 @@
package main
import (
+ "image"
"image/color"
+ _ "image/jpeg"
"os"
"github.com/hajimehoshi/ebiten/v2"
@@ -133,6 +135,16 @@ func main() {
slog.SetDefault(slog.New(logHandler))
ebiten.SetWindowSize(640, 480)
ebiten.SetWindowTitle("Age of Empire")
+ icon, err := os.Open("icon-crop.jpg")
+ if err != nil {
+ panic(err)
+ }
+ defer icon.Close()
+ iconImg, _, err := image.Decode(icon)
+ if err != nil {
+ panic(err)
+ }
+ ebiten.SetWindowIcon([]image.Image{iconImg})
game := &Game{}
ironImage := NewFilledRectangleImage(Point{100, 100}, color.RGBA{0x80, 0x80, 0x80, 0xff})
ironHaloImage := NewStrokeRectangleImage(Point{110, 110}, SELECTION_HALO_SIZE, color.RGBA{0xff, 0x00, 0x00, 0xff})