diff --git a/batch.go b/batch.go index 09c25f5ac3914cd33fe55e4cbf386fc6ff76bb0f..3e176808d4c24c2fc5f3d399fe0669fcc223cced 100644 --- a/batch.go +++ b/batch.go @@ -23,8 +23,9 @@ var _ BasicTarget = (*Batch)(nil) // NewBatch creates an empty Batch with the specified Picture and container. // -// The container is where objects get accumulated. Batch will support precisely those vertex -// properties, that the supplied container supports. +// The container is where objects get accumulated. Batch will support precisely those Triangles +// properties, that the supplied container supports. If you retain access to the container and +// change it, call Dirty to notify Batch about the change. // // Note, that if the container does not support TrianglesColor, color masking will not work. func NewBatch(container Triangles, pic Picture) *Batch { @@ -35,6 +36,17 @@ func NewBatch(container Triangles, pic Picture) *Batch { } } +// Dirty notifies Batch about an external modification of it's container. If you retain access to +// the Batch's container and change it, call Dirty to notify Batch about the change. +// +// container := &pixel.TrianglesData{} +// batch := pixel.NewBatch(container, nil) +// container.SetLen(10) // changed container from outside of Batch +// batch.Dirty() // notify Batch about the change +func (b *Batch) Dirty() { + b.cont.Dirty() +} + // Clear removes all objects from the Batch. func (b *Batch) Clear() { b.cont.Triangles.SetLen(0)