progress using my own graphics interface

This commit is contained in:
2026-01-06 00:35:24 -06:00
parent 59a2f08349
commit bbad63c60a
7 changed files with 230 additions and 195 deletions

View File

@@ -1,18 +1,18 @@
package main
import (
"github.com/gen2brain/raylib-go/raylib"
"math"
"math/rand"
"github.com/gen2brain/raylib-go/raylib"
)
type ContourLayer struct {
field Field
rng *rand.Rand
maxActors uint32
actors []*Actor
actorIndex uint32
actorColor rl.Color
field Field
rng *rand.Rand
maxActors uint32
actors []*Actor
actorIndex uint32
actorColor rl.Color
loActorAngle float32
hiActorAngle float32
}
@@ -23,13 +23,13 @@ func NewContourLayer(sketch *Sketch, rng *rand.Rand, field Field, color rl.Color
actors := make([]*Actor, maxActors)
layer := ContourLayer {
rng: rng,
field: field,
actors: actors,
maxActors: uint32(maxActors),
actorColor: color,
actorIndex: 0,
layer := ContourLayer{
rng: rng,
field: field,
actors: actors,
maxActors: uint32(maxActors),
actorColor: color,
actorIndex: 0,
loActorAngle: loActorAngle,
hiActorAngle: hiActorAngle,
}
@@ -42,13 +42,13 @@ func (s *ContourLayer) AddActors(color rl.Color, n, sourceWidth, sourceHeight in
x := s.rng.Int31() % sourceWidth
y := s.rng.Int31() % sourceHeight
newActor :=
&Actor {
&Actor{
position: rl.Vector2{X: float32(x), Y: float32(y)},
field: s.field,
stepSize: 1,
color: s.actorColor,
loAngle: s.loActorAngle,
hiAngle: s.hiActorAngle,
loAngle: s.loActorAngle,
hiAngle: s.hiActorAngle,
}
s.actors[s.actorIndex] = newActor
s.actorIndex = (s.actorIndex + 1) % s.maxActors
@@ -133,4 +133,3 @@ func (w *Worm) Draw(ctx *RenderCtx) {
rl.PopMatrix()
w.angleIndex = (w.angleIndex + 1) % len(w.angles)
}