diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-10-06 09:20:29 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-10-06 09:20:29 +0200 |
| commit | 987aa73f11f4c5fbc7136313c77aaad42e7e9edd (patch) | |
| tree | 2108951ec23042c962ef243834a47ac7766e30cd | |
| parent | 0735888213d8575cf870f22d4d905af3f3c1ac9b (diff) | |
feat: Add window icon
| -rw-r--r-- | icon-crop.jpg | bin | 0 -> 202400 bytes | |||
| -rw-r--r-- | main.go | 12 |
2 files changed, 12 insertions, 0 deletions
diff --git a/icon-crop.jpg b/icon-crop.jpg Binary files differnew file mode 100644 index 0000000..8b94fe1 --- /dev/null +++ b/icon-crop.jpg @@ -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}) |
