Basic: buffer
buffer
The key features
- Memory control and always safe with array limits
- Common component to multiple purposes
The buffer is one of the key primitives of AnimationCPU. It is used to store and manipulate data and text. Everything uses a buffer. A buffer is always a 2D table with rows and columns, allowing you to store multiline text, easily attach any kind of data, and solve 80% of tasks more efficiently with 2D structures. If you're used to working with 1D arrays in other languages, you'll be pleasantly surprised by the possibilities a 2D buffer unlocks for vibe coding.
import
_ @sys.obj;
buffer.clone - text clone
text0=buffer.clone(u0, strings0,i);
buffer.trim.left.eol - text trim
query0 = buffer.trim.left.eol(text0);
buffer.dma - attach to dma
buffer.dma(u0, 0, vg0,0);
buffer clear
Buffer clear
buffer.dma(u0, dma0, buf0,0);
dma.strip.size(u0, dma0, 0);
buffer resize
Buffer resize
buffer.dma(u0, dma0, buf0,0);
dma.strip.size(u0, dma0, 10);
buffer.new.rect0 - new v2rect array
buffer.new.rect0(dma, id, x,y, w,h);
buffer.add.rect0 - add to v2rect array
buffer.add.rect0(dma, id, x,y, w,h);
buffer.set
buffer.set3(u0, buf,i,offs, v0,v1,v2)
buffer.clone - buffer clone
buffer.clone str.clone(__);
buffer.set.size - buffer resize
buffer.set.size(u0, buf0,i, size);
str.clone - clone string to buffer
str.clone(buf,i); -> buf