From 33e014e0de10f61c560059b4672ad7f2261f52ac Mon Sep 17 00:00:00 2001 From: sumi Date: Fri, 26 Dec 2025 01:13:32 -0600 Subject: [PATCH] automated snapshot --- internal/graphics/graphics.go | 13 +++++++++---- main.go | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/graphics/graphics.go b/internal/graphics/graphics.go index d2cae53..9e0df42 100644 --- a/internal/graphics/graphics.go +++ b/internal/graphics/graphics.go @@ -1,6 +1,7 @@ package graphics import ( + "fmt" "math/rand" rl "github.com/gen2brain/raylib-go/raylib" ) @@ -23,6 +24,8 @@ func makeFlourescentColors() []rl.Color { for i, hue := range(FlourescentHues) { fc[i] = rl.ColorFromHSV(hue, 1.0, 1.0) } + fmt.Printf("flourescent colors --> %v\n", fc) + return fc } @@ -35,22 +38,24 @@ type ArrayBackedColorCycle struct { index int } -func NewFixedColorCycle(colors []rl.Color) ArrayBackedColorCycle { - return ArrayBackedColorCycle { +func NewFixedColorCycle(colors []rl.Color) *ArrayBackedColorCycle { + return &ArrayBackedColorCycle { colors: colors, index: 0, } } -func (c ArrayBackedColorCycle) Shuffle(seed int64) ColorCycle { +func (c ArrayBackedColorCycle) Shuffle(seed int64) *ArrayBackedColorCycle { r := rand.New(rand.NewSource(seed)) cprime := &ArrayBackedColorCycle { colors: make([]rl.Color, len(c.colors)), index: 0, } + copy(cprime.colors, c.colors) r.Shuffle(len(c.colors), func(i, j int) { - cprime.colors[i] = c.colors[j] + cprime.colors[i], cprime.colors[j] = cprime.colors[j], cprime.colors[i] }) + fmt.Printf("shuffled colors --> %v\n", cprime.colors) return cprime } diff --git a/main.go b/main.go index d8f3109..91d27a5 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,7 @@ func main() { BlendModeToggleGroupActive := int32(0) // reproducable flourescent color cycle - colorCycle := g.NewFixedColorCycle(g.FlourescentColors)//.Shuffle(0) + colorCycle := g.NewFixedColorCycle(g.FlourescentColors).Shuffle(0) rl.SetTargetFPS(60) t0 := time.Now()