mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-18 04:51:05 +01:00
initial options bug fixed
See
424f62327b
Thanks a lot for the fast support, amazing!
This commit is contained in:
@@ -82,35 +82,36 @@ func (scene *SceneOptions) Init() {
|
||||
rowContainer := NewRowContainer("Options")
|
||||
|
||||
pause := NewCheckbox("Pause",
|
||||
scene.Config.Paused,
|
||||
func(args *widget.CheckboxChangedEventArgs) {
|
||||
scene.Config.TogglePaused()
|
||||
})
|
||||
|
||||
debugging := NewCheckbox("Debugging",
|
||||
scene.Config.Debug,
|
||||
func(args *widget.CheckboxChangedEventArgs) {
|
||||
scene.Config.ToggleDebugging()
|
||||
})
|
||||
scene.SetInitialValue(debugging, scene.Config.Debug)
|
||||
|
||||
gridlines := NewCheckbox("Show grid lines",
|
||||
scene.Config.ShowGrid,
|
||||
func(args *widget.CheckboxChangedEventArgs) {
|
||||
fmt.Println("CHECKBOX CALLED")
|
||||
repr.Println(args.State)
|
||||
scene.Config.ToggleGridlines()
|
||||
})
|
||||
scene.SetInitialValue(gridlines, scene.Config.ShowGrid)
|
||||
|
||||
evolution := NewCheckbox("Show evolution traces",
|
||||
scene.Config.ShowEvolution,
|
||||
func(args *widget.CheckboxChangedEventArgs) {
|
||||
scene.Config.ToggleEvolution()
|
||||
})
|
||||
scene.SetInitialValue(evolution, scene.Config.ShowEvolution)
|
||||
|
||||
wrap := NewCheckbox("Wrap around edges",
|
||||
scene.Config.Wrap,
|
||||
func(args *widget.CheckboxChangedEventArgs) {
|
||||
scene.Config.ToggleWrap()
|
||||
})
|
||||
scene.SetInitialValue(wrap, scene.Config.Wrap)
|
||||
|
||||
themes := NewCombobox(
|
||||
[]string{"dark", "light"},
|
||||
@@ -118,6 +119,7 @@ func (scene *SceneOptions) Init() {
|
||||
func(args *widget.ListComboButtonEntrySelectedEventArgs) {
|
||||
scene.Config.SwitchTheme(args.Entry.(ListEntry).Name)
|
||||
})
|
||||
|
||||
themelabel := NewLabel("Themes")
|
||||
combocontainer := NewColumnContainer()
|
||||
combocontainer.AddChild(themes)
|
||||
|
||||
@@ -42,11 +42,17 @@ func NewMenuButton(
|
||||
|
||||
func NewCheckbox(
|
||||
text string,
|
||||
initialvalue bool,
|
||||
action func(args *widget.CheckboxChangedEventArgs)) *widget.LabeledCheckbox {
|
||||
|
||||
checkboxImage, _ := LoadCheckboxImage()
|
||||
buttonImage, _ := LoadButtonImage()
|
||||
|
||||
var state widget.WidgetState
|
||||
if initialvalue {
|
||||
state = widget.WidgetChecked
|
||||
}
|
||||
|
||||
return widget.NewLabeledCheckbox(
|
||||
widget.LabeledCheckboxOpts.CheckboxOpts(
|
||||
widget.CheckboxOpts.ButtonOpts(
|
||||
@@ -54,6 +60,7 @@ func NewCheckbox(
|
||||
),
|
||||
widget.CheckboxOpts.Image(checkboxImage),
|
||||
widget.CheckboxOpts.StateChangedHandler(action),
|
||||
widget.CheckboxOpts.InitialState(state),
|
||||
),
|
||||
widget.LabeledCheckboxOpts.LabelOpts(
|
||||
widget.LabelOpts.Text(text, *FontRenderer.FontSmall,
|
||||
|
||||
Reference in New Issue
Block a user