mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-16 12:10:58 +01:00
cleanup and added video to readme
This commit is contained in:
@@ -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
|
||||
[](https://www.youtube.com/watch?v=xEto6Oew16I)
|
||||
|
||||
# Features
|
||||
|
||||
* flexible parameters as grid and cell size
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user