automated snapshot

This commit is contained in:
sumi
2025-12-23 12:06:13 -06:00
parent 5cbb9aee14
commit f2049e569d
2 changed files with 30 additions and 7 deletions

View File

@@ -68,7 +68,7 @@ func NewSketch(sourceWidth, sourceHeight int32) Sketch {
}
}
func (s *Sketch) CreateLayer(name string, layer Layer) {
func (s *Sketch) AddLayer(name string, layer Layer) {
texture := rl.LoadRenderTexture(s.sourceWidth, s.sourceHeight)
config := NewLayerConfig()
layerTools :=
@@ -82,6 +82,14 @@ func (s *Sketch) CreateLayer(name string, layer Layer) {
s.layerTools[name] = &layerTools
}
func (s *Sketch) AddColorLayer(name string, c rl.Color) {
colorLayer := &ColorLayer {
color: c,
dirty: true,
}
s.AddLayer(name, colorLayer)
}
func (s *Sketch) Draw(ctx *RenderCtx) {
// render onto all layer textures
for _, instance := range s.layerToolsOrdered {
@@ -265,6 +273,22 @@ type Layer interface {
IsDirty() bool
}
type ColorLayer struct {
color rl.Color
dirty bool
}
func (cl *ColorLayer) Update(ctx *RenderCtx) {
;
}
func (cl *ColorLayer) Draw(ctx *RenderCtx) {
rl.DrawRectangle(0, 0, ctx.SourceWidth, ctx.SourceHeight, cl.color)
}
func (cl *ColorLayer) IsDirty() bool {
return cl.dirty
}
type ImageLayer struct {
texture rl.Texture2D
@@ -293,7 +317,6 @@ func (il *ImageLayer) IsDirty() bool {
return il.dirty
}
type TestPattern struct{
dirty bool
}