This commit is contained in:
2026-01-03 08:25:55 -06:00
parent 249b78d141
commit 50bee7a5c0
5 changed files with 50 additions and 30 deletions

View File

@@ -2,27 +2,9 @@
//
// Returns a function that creates sprite instances via meme()
var dirty = {}
var sprite = {
type: 'sprite',
pos: null,
layer: 0,
image: null,
width: 1,
height: 1,
anchor_x: 0,
anchor_y: 0,
scale_x: 1,
scale_y: 1,
color: null,
uv_rect: null,
slice: null,
tile: null,
material: null,
opacity: 1,
// Dirty tracking
dirty: 7, // DIRTY.ALL
// Setters that mark dirty
set_pos: function(x, y) {
if (!this.pos) this.pos = {x: 0, y: 0}
@@ -79,5 +61,25 @@ stone(sprite)
// Factory function
return function(props) {
return meme(sprite, props)
var defaults = {
pos: {x:0,y:0},
layer: 0,
image: null,
width: 1,
height: 1,
anchor_x: 0,
anchor_y: 0,
scale_x: 1,
scale_y: 1,
color: null,
uv_rect: null,
slice: null,
tile: null,
material: null,
opacity: 1,
}
var newsprite = meme(sprite, [defaults,props])
newsprite[dirty] = 7
return newsprite
}