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
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
}

View File

@@ -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()