diff --git a/README.md b/README.md index fdfdb6c..84b5a3f 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ John Conway himself: https://youtu.be/R9Plq-D1gEk?si=yYxs77e9yXxeSNbL Based on: https://youtu.be/FWSR_7kZuYg?si=ix1dmo76D8AmF25F +https://youtu.be/xEto6Oew16I +[![game preview](https://img.youtube.com/vi/xEto6Oew16I/0.jpg)](https://www.youtube.com/watch?v=xEto6Oew16I) + # Features * flexible parameters as grid and cell size diff --git a/src/config.go b/src/config.go index ce2db9c..5b479b6 100644 --- a/src/config.go +++ b/src/config.go @@ -223,21 +223,20 @@ func ParseCommandline() (*Config, error) { pflag.StringVarP(&rlefile, "pattern-file", "f", "", "RLE or LIF pattern file") pflag.BoolVarP(&config.ShowVersion, "version", "v", false, "show version") + pflag.BoolVarP(&config.ShowGrid, "show-grid", "g", false, "draw grid lines") + pflag.BoolVarP(&config.ShowEvolution, "show-evolution", "s", false, "show evolution traces") + pflag.BoolVarP(&config.Paused, "paused", "p", false, "do not start simulation (use space to start)") pflag.BoolVarP(&config.Debug, "debug", "d", false, "show debug info") - pflag.BoolVarP(&config.ShowGrid, "show-grid", "g", false, "draw grid lines") pflag.BoolVarP(&config.Empty, "empty", "e", false, "start with an empty screen") // style pflag.StringVarP(&config.Theme, "theme", "T", DEFAULT_THEME, "color theme: standard, dark, light (default: standard)") - pflag.BoolVarP(&config.ShowEvolution, "show-evolution", "s", false, "show evolution traces") pflag.BoolVarP(&config.Wrap, "wrap-around", "w", false, "wrap around grid mode") pflag.BoolVarP(&config.UseShader, "use-shader", "k", false, "use shader for cell rendering") pflag.StringVarP(&config.ProfileFile, "profile-file", "", "", "enable profiling") - pflag.BoolVarP(&config.ProfileDraw, "profile-draw", "", false, "profile draw method (default false)") - pflag.Int64VarP(&config.ProfileMaxLoops, "profile-max-loops", "", 10, "how many loops to execute (default 10)") pflag.Parse() @@ -278,8 +277,10 @@ func (config *Config) SwitchTheme(theme string) { } func (config *Config) ToggleGridlines() { + fmt.Printf("toggle grid lines, current: %t\n", config.ShowGrid) config.ShowGrid = !config.ShowGrid config.RestartCache = true + fmt.Printf("toggle grid lines, new: %t\n", config.ShowGrid) } func (config *Config) ToggleEvolution() { diff --git a/src/options.go b/src/options.go index cb9cc27..633cfa7 100644 --- a/src/options.go +++ b/src/options.go @@ -1,8 +1,10 @@ package main import ( + "fmt" "image/color" + "github.com/alecthomas/repr" "github.com/ebitenui/ebitenui" "github.com/ebitenui/ebitenui/widget" "github.com/hajimehoshi/ebiten/v2" @@ -69,14 +71,11 @@ func (scene *SceneOptions) Draw(screen *ebiten.Image) { } func (scene *SceneOptions) SetInitialValue(w *widget.LabeledCheckbox, value bool) { - var intval int if value { - intval = 1 + w.SetState( + widget.WidgetChecked, + ) } - - w.SetState( - widget.WidgetState(intval), - ) } func (scene *SceneOptions) Init() { @@ -95,6 +94,8 @@ func (scene *SceneOptions) Init() { gridlines := NewCheckbox("Show grid lines", func(args *widget.CheckboxChangedEventArgs) { + fmt.Println("CHECKBOX CALLED") + repr.Println(args.State) scene.Config.ToggleGridlines() }) scene.SetInitialValue(gridlines, scene.Config.ShowGrid) diff --git a/src/play.go b/src/play.go index 8717a0f..82d6257 100644 --- a/src/play.go +++ b/src/play.go @@ -184,6 +184,7 @@ func (scene *ScenePlay) CheckInput() { if inpututil.IsKeyJustPressed(ebiten.KeyC) { scene.Config.Markmode = true + scene.Config.Drawmode = false scene.Config.Paused = true }