(icons ...*sdl.FRect)
| 1351 | } |
| 1352 | |
| 1353 | func (bg *IconButtonGroup) SetButtons(icons ...*sdl.FRect) { |
| 1354 | |
| 1355 | for _, b := range bg.Buttons { |
| 1356 | b.Destroy() |
| 1357 | } |
| 1358 | |
| 1359 | bg.Buttons = []*IconButton{} |
| 1360 | |
| 1361 | for i, src := range icons { |
| 1362 | |
| 1363 | index := i |
| 1364 | bg.Buttons = append(bg.Buttons, NewIconButton(0, 0, src, globals.GUITexture, bg.WorldSpace, func() { |
| 1365 | bg.ChosenIndex = index |
| 1366 | if bg.Property != nil { |
| 1367 | bg.Property.Set(float64(index)) |
| 1368 | } |
| 1369 | if bg.OnChoose != nil { |
| 1370 | bg.OnChoose(index) |
| 1371 | } |
| 1372 | })) |
| 1373 | |
| 1374 | } |
| 1375 | |
| 1376 | } |
| 1377 | |
| 1378 | func (bg *IconButtonGroup) Update() { |
| 1379 |
no test coverage detected