ToggleGroup cleanup [minor]
This commit is contained in:
parent
e30bdc3edc
commit
a9c43af1bc
1 changed files with 3 additions and 2 deletions
|
@ -4,10 +4,11 @@ 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 {
|
||||
padding := float32(style[TogglegroupPadding])
|
||||
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) {
|
||||
ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+padding), bounds.Y, bounds.Width, bounds.Height), toggleText[i], true)
|
||||
} else if ToggleButton(rl.NewRectangle(bounds.X+float32(i)*(bounds.Width+padding), bounds.Y, bounds.Width, bounds.Height), toggleText[i], false) {
|
||||
active = i
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue