From 451f389ef64eca26f41835fe6fa789e77da0370f Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Thu, 20 Feb 2020 18:15:29 +0100 Subject: [PATCH] Extended Display.SetIcon to allow multiple icons. --- display.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/display.go b/display.go index 61925db..927d9e7 100644 --- a/display.go +++ b/display.go @@ -115,8 +115,20 @@ func (d *Display) SetAsTarget() { C.al_set_target_backbuffer(d.display) } -func (d *Display) SetIcon(i *Bitmap) { - C.al_set_display_icon(d.display, i.bitmap) +func (d *Display) SetIcon(i ...*Bitmap) { + if len(i) == 0 { + return + } + if len(i) == 1 { + C.al_set_display_icon(d.display, i[0].bitmap) + return + } + + icons := make([]*C.ALLEGRO_BITMAP, len(i)) + for j := range icons { + icons[j] = i[j].bitmap + } + C.al_set_display_icons(d.display, C.int(len(icons)), &(icons[0])) } func (d *Display) SetMouseCursor(c MouseCursor) {