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