length
This commit is contained in:
10
graphics.cm
10
graphics.cm
@@ -163,7 +163,7 @@ function create_image(path){
|
||||
/* ── Case B: array of surfaces (from make_gif) ────────────── */
|
||||
if(is_array(raw)) {
|
||||
// Single frame GIF returns array with one surface
|
||||
if(raw.length == 1 && !raw[0].time) {
|
||||
if(length(raw) == 1 && !raw[0].time) {
|
||||
return new graphics.Image(raw[0])
|
||||
}
|
||||
// Multiple frames - create animation
|
||||
@@ -184,7 +184,7 @@ function create_image(path){
|
||||
else if(anim && anim.surface)
|
||||
anims[name] = new graphics.Image(anim.surface);
|
||||
}
|
||||
if(array(anims).length) return anims;
|
||||
if(length(array(anims))) return anims;
|
||||
}
|
||||
|
||||
throw Error('Unsupported image structure from decoder');
|
||||
@@ -340,7 +340,7 @@ graphics.texture = function texture(path) {
|
||||
return anim
|
||||
} else if (anim.frames && is_array(anim.frames)) {
|
||||
// Multi-frame animation - wrap the index
|
||||
idx = idx % anim.frames.length
|
||||
idx = idx % length(anim.frames)
|
||||
return anim.frames[idx].image
|
||||
}
|
||||
}
|
||||
@@ -435,9 +435,9 @@ graphics.get_font = function get_font(path) {
|
||||
|
||||
graphics.queue_sprite_mesh = function(queue) {
|
||||
var sprites = filter(queue, x => x.type == 'sprite')
|
||||
if (sprites.length == 0) return []
|
||||
if (length(sprites) == 0) return []
|
||||
var mesh = graphics.make_sprite_mesh(sprites)
|
||||
for (var i = 0; i < sprites.length; i++) {
|
||||
for (var i = 0; i < length(sprites); i++) {
|
||||
sprites[i].mesh = mesh
|
||||
sprites[i].first_index = i*6
|
||||
sprites[i].num_indices = 6
|
||||
|
||||
Reference in New Issue
Block a user