MCPcopy Create free account
hub / github.com/SolarLune/masterplan / SetButtons

Method SetButtons

gui.go:1353–1376  ·  view source on GitHub ↗
(icons ...*sdl.FRect)

Source from the content-addressed store, hash-verified

1351}
1352
1353func (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
1378func (bg *IconButtonGroup) Update() {
1379

Callers 1

NewIconButtonGroupFunction · 0.95

Calls 3

NewIconButtonFunction · 0.85
DestroyMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected