automated snapshot

This commit is contained in:
sumi
2025-12-26 01:13:32 -06:00
parent 5755e953b2
commit 33e014e0de
2 changed files with 10 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package graphics package graphics
import ( import (
"fmt"
"math/rand" "math/rand"
rl "github.com/gen2brain/raylib-go/raylib" rl "github.com/gen2brain/raylib-go/raylib"
) )
@@ -23,6 +24,8 @@ func makeFlourescentColors() []rl.Color {
for i, hue := range(FlourescentHues) { for i, hue := range(FlourescentHues) {
fc[i] = rl.ColorFromHSV(hue, 1.0, 1.0) fc[i] = rl.ColorFromHSV(hue, 1.0, 1.0)
} }
fmt.Printf("flourescent colors --> %v\n", fc)
return fc return fc
} }
@@ -35,22 +38,24 @@ type ArrayBackedColorCycle struct {
index int index int
} }
func NewFixedColorCycle(colors []rl.Color) ArrayBackedColorCycle { func NewFixedColorCycle(colors []rl.Color) *ArrayBackedColorCycle {
return ArrayBackedColorCycle { return &ArrayBackedColorCycle {
colors: colors, colors: colors,
index: 0, index: 0,
} }
} }
func (c ArrayBackedColorCycle) Shuffle(seed int64) ColorCycle { func (c ArrayBackedColorCycle) Shuffle(seed int64) *ArrayBackedColorCycle {
r := rand.New(rand.NewSource(seed)) r := rand.New(rand.NewSource(seed))
cprime := &ArrayBackedColorCycle { cprime := &ArrayBackedColorCycle {
colors: make([]rl.Color, len(c.colors)), colors: make([]rl.Color, len(c.colors)),
index: 0, index: 0,
} }
copy(cprime.colors, c.colors)
r.Shuffle(len(c.colors), func(i, j int) { 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 return cprime
} }

View File

@@ -49,7 +49,7 @@ func main() {
BlendModeToggleGroupActive := int32(0) BlendModeToggleGroupActive := int32(0)
// reproducable flourescent color cycle // reproducable flourescent color cycle
colorCycle := g.NewFixedColorCycle(g.FlourescentColors)//.Shuffle(0) colorCycle := g.NewFixedColorCycle(g.FlourescentColors).Shuffle(0)
rl.SetTargetFPS(60) rl.SetTargetFPS(60)
t0 := time.Now() t0 := time.Now()