mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-17 04:30:57 +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
|
Based on: https://youtu.be/FWSR_7kZuYg?si=ix1dmo76D8AmF25F
|
||||||
|
|
||||||
|
https://youtu.be/xEto6Oew16I
|
||||||
|
[](https://www.youtube.com/watch?v=xEto6Oew16I)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* flexible parameters as grid and cell size
|
* 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.StringVarP(&rlefile, "pattern-file", "f", "", "RLE or LIF pattern file")
|
||||||
|
|
||||||
pflag.BoolVarP(&config.ShowVersion, "version", "v", false, "show version")
|
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.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.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")
|
pflag.BoolVarP(&config.Empty, "empty", "e", false, "start with an empty screen")
|
||||||
|
|
||||||
// style
|
// style
|
||||||
pflag.StringVarP(&config.Theme, "theme", "T", DEFAULT_THEME, "color theme: standard, dark, light (default: standard)")
|
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.Wrap, "wrap-around", "w", false, "wrap around grid mode")
|
||||||
pflag.BoolVarP(&config.UseShader, "use-shader", "k", false, "use shader for cell rendering")
|
pflag.BoolVarP(&config.UseShader, "use-shader", "k", false, "use shader for cell rendering")
|
||||||
|
|
||||||
pflag.StringVarP(&config.ProfileFile, "profile-file", "", "", "enable profiling")
|
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()
|
pflag.Parse()
|
||||||
|
|
||||||
@@ -278,8 +277,10 @@ func (config *Config) SwitchTheme(theme string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) ToggleGridlines() {
|
func (config *Config) ToggleGridlines() {
|
||||||
|
fmt.Printf("toggle grid lines, current: %t\n", config.ShowGrid)
|
||||||
config.ShowGrid = !config.ShowGrid
|
config.ShowGrid = !config.ShowGrid
|
||||||
config.RestartCache = true
|
config.RestartCache = true
|
||||||
|
fmt.Printf("toggle grid lines, new: %t\n", config.ShowGrid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) ToggleEvolution() {
|
func (config *Config) ToggleEvolution() {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
|
"github.com/alecthomas/repr"
|
||||||
"github.com/ebitenui/ebitenui"
|
"github.com/ebitenui/ebitenui"
|
||||||
"github.com/ebitenui/ebitenui/widget"
|
"github.com/ebitenui/ebitenui/widget"
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
@@ -69,15 +71,12 @@ func (scene *SceneOptions) Draw(screen *ebiten.Image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (scene *SceneOptions) SetInitialValue(w *widget.LabeledCheckbox, value bool) {
|
func (scene *SceneOptions) SetInitialValue(w *widget.LabeledCheckbox, value bool) {
|
||||||
var intval int
|
|
||||||
if value {
|
if value {
|
||||||
intval = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
w.SetState(
|
w.SetState(
|
||||||
widget.WidgetState(intval),
|
widget.WidgetChecked,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (scene *SceneOptions) Init() {
|
func (scene *SceneOptions) Init() {
|
||||||
rowContainer := NewRowContainer("Options")
|
rowContainer := NewRowContainer("Options")
|
||||||
@@ -95,6 +94,8 @@ func (scene *SceneOptions) Init() {
|
|||||||
|
|
||||||
gridlines := NewCheckbox("Show grid lines",
|
gridlines := NewCheckbox("Show grid lines",
|
||||||
func(args *widget.CheckboxChangedEventArgs) {
|
func(args *widget.CheckboxChangedEventArgs) {
|
||||||
|
fmt.Println("CHECKBOX CALLED")
|
||||||
|
repr.Println(args.State)
|
||||||
scene.Config.ToggleGridlines()
|
scene.Config.ToggleGridlines()
|
||||||
})
|
})
|
||||||
scene.SetInitialValue(gridlines, scene.Config.ShowGrid)
|
scene.SetInitialValue(gridlines, scene.Config.ShowGrid)
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ func (scene *ScenePlay) CheckInput() {
|
|||||||
|
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyC) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyC) {
|
||||||
scene.Config.Markmode = true
|
scene.Config.Markmode = true
|
||||||
|
scene.Config.Drawmode = false
|
||||||
scene.Config.Paused = true
|
scene.Config.Paused = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user