Added an icon.
This commit is contained in:
parent
63ffc04017
commit
95bc1367c7
@ -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()
|
||||
|
||||
|
BIN
cmd/krampus19/res/icon.png
Normal file
BIN
cmd/krampus19/res/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user