automated snapshot
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user