diff --git a/cmd/krampus19/krampus19.go b/cmd/krampus19/krampus19.go index 69a7d10..7f89228 100644 --- a/cmd/krampus19/krampus19.go +++ b/cmd/krampus19/krampus19.go @@ -35,11 +35,11 @@ func run() error { cons := &gut.Console{} log.SetOutput(io.MultiWriter(log.Writer(), cons)) - log.Printf("Initializing Allegro.") - err := allg5.Init(allg5.InitAll) + res, err := resources() if err != nil { return err } + defer res.Destroy() settings := newDefaultSettings() err = settings.LoadDefault() @@ -51,11 +51,16 @@ func run() error { log.Printf("Unable to store settings; err: %v", err) } + log.Printf("Initializing Allegro.") + err = allg5.Init(allg5.InitAll) + if err != nil { + return err + } + log.Printf("Creating display.") var size = geom.Pt(1280, 720) - dispOptions := allg5.NewDisplayOptions{Vsync: true} + dispOptions := allg5.NewDisplayOptions{Vsync: true, Fullscreen: true} if settings.Video.Windowed { - dispOptions.Maximized = true dispOptions.Frameless = true dispOptions.Windowed = true } else { @@ -73,6 +78,19 @@ func run() error { } defer disp.Destroy() + iconPath, err := res.Retrieve("icon.png") + if err != nil { + log.Printf("Unable to retrieve icon.") + } else { + icon, err := allg5.LoadBitmap(iconPath) + if err != nil { + log.Printf("Unable to load icon bitmap.") + } else { + defer icon.Destroy() + disp.SetIcon(icon) + } + } + eq, err := allg5.NewEventQueue() if err != nil { return err @@ -83,12 +101,6 @@ func run() error { eq.RegisterKeyboard() eq.RegisterMouse() - res, err := resources() - if err != nil { - return err - } - defer res.Destroy() - fps := gut.NewFPS() defer fps.Destroy() diff --git a/cmd/krampus19/res/icon.png b/cmd/krampus19/res/icon.png new file mode 100644 index 0000000..507c0c7 Binary files /dev/null and b/cmd/krampus19/res/icon.png differ