Address review comments
This commit is contained in:
parent
8ae8551fda
commit
ac4239754f
|
@ -1,11 +1,10 @@
|
||||||
package pixelgl
|
package pixelgl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"image"
|
|
||||||
|
|
||||||
"github.com/faiface/glhf"
|
"github.com/faiface/glhf"
|
||||||
"github.com/faiface/mainthread"
|
"github.com/faiface/mainthread"
|
||||||
"github.com/faiface/pixel"
|
"github.com/faiface/pixel"
|
||||||
|
@ -22,15 +21,17 @@ type WindowConfig struct {
|
||||||
// Title at the top of the Window.
|
// Title at the top of the Window.
|
||||||
Title string
|
Title string
|
||||||
|
|
||||||
// Icons specifies the icon images used by the window. This is usually displayed
|
// Icon specifies the icon images available to be used by the window. This is usually displayed
|
||||||
// in the top bar of the window or in the task bar of the desktop environment.
|
// in the top bar of the window or in the task bar of the desktop environment.
|
||||||
|
//
|
||||||
// If passed one image, it will use that image, if passed an array of images
|
// If passed one image, it will use that image, if passed an array of images
|
||||||
// those of or closest to the sizes desired by the system are selected.
|
// those of or closest to the sizes desired by the system are selected.
|
||||||
// The desired image sizes varies depending on platform and system settings. The selected
|
// The desired image sizes varies depending on platform and system settings. The selected
|
||||||
// images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
|
// images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
|
||||||
// NOTE: Setting this value doesn't have an effect on OSX. You'll need to set the icon
|
//
|
||||||
|
// Note: Setting this value doesn't have an effect on OSX. You'll need to set the icon
|
||||||
// when bundling your application for release.
|
// when bundling your application for release.
|
||||||
Icons []pixel.Picture
|
Icon []pixel.Picture
|
||||||
|
|
||||||
// Bounds specify the bounds of the Window in pixels.
|
// Bounds specify the bounds of the Window in pixels.
|
||||||
Bounds pixel.Rect
|
Bounds pixel.Rect
|
||||||
|
@ -130,16 +131,14 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
|
||||||
w.Update()
|
w.Update()
|
||||||
|
|
||||||
runtime.SetFinalizer(w, (*Window).Destroy)
|
runtime.SetFinalizer(w, (*Window).Destroy)
|
||||||
if len(cfg.Icons) > 0 {
|
imgs := make([]image.Image, len(cfg.Icon))
|
||||||
var imgs []image.Image
|
for _, v := range cfg.Icon {
|
||||||
for _, v := range cfg.Icons {
|
|
||||||
pic := pixel.PictureDataFromPicture(v)
|
pic := pixel.PictureDataFromPicture(v)
|
||||||
imgs = append(imgs, pic.Image())
|
imgs = append(imgs, pic.Image())
|
||||||
}
|
}
|
||||||
mainthread.Call(func() {
|
mainthread.Call(func() {
|
||||||
w.window.SetIcon(imgs)
|
w.window.SetIcon(imgs)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
return w, nil
|
return w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue