- per-control .go file, - separate file for style/property stuff, - added NumProperties enum to the list of properties for constraint checking, - should be no code changes
16 lines
647 B
Go
16 lines
647 B
Go
package raygui
|
|
|
|
import "github.com/gen2brain/raylib-go/raylib"
|
|
|
|
// ToggleGroup - Toggle Group element, returns toggled button index
|
|
func ToggleGroup(bounds rl.Rectangle, toggleText []string, active int) int {
|
|
for i := 0; i < len(toggleText); i++ {
|
|
if i == active {
|
|
ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+float32(style[TogglegroupPadding])), bounds.Y, bounds.Width, bounds.Height), toggleText[i], true)
|
|
} else if ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+float32(style[TogglegroupPadding])), bounds.Y, bounds.Width, bounds.Height), toggleText[i], false) {
|
|
active = i
|
|
}
|
|
}
|
|
|
|
return active
|
|
}
|