diff --git a/prosperon/draw2d.cm b/prosperon/draw2d.cm index 131e504e..b0f37b64 100644 --- a/prosperon/draw2d.cm +++ b/prosperon/draw2d.cm @@ -137,7 +137,7 @@ draw.slice9 = function slice9(image, rect = [0,0], slice = 0, info = slice9_info }) } -draw.image = function image(image, rect, rotation, anchor, shear, info = {mode:"nearest"}, material = {color:{r:1,g:1,b:1,a:1}}) { +draw.image = function image(image, rect, scale = {x:1,y:1}, anchor, shear, info = {mode:"nearest"}, material = {color:{r:1,g:1,b:1,a:1}}) { if (!rect) throw Error('Need rectangle to render image.') if (!image) throw Error('Need an image to render.') @@ -146,7 +146,7 @@ draw.image = function image(image, rect, rotation, anchor, shear, info = {mode:" add_command("draw_image", { image, rect, - rotation, + scale, anchor, shear, info, diff --git a/prosperon/prosperon.cm b/prosperon/prosperon.cm index 90a02c76..aa93d502 100644 --- a/prosperon/prosperon.cm +++ b/prosperon/prosperon.cm @@ -193,8 +193,11 @@ function translate_draw_commands(commands) { var gpu = img.gpu if (!gpu) break + if (!cmd.scale) cmd.scale = {x:1,y:1} cmd.rect.width ??= img.width cmd.rect.height ??= img.height + cmd.rect.width = cmd.rect.width * cmd.scale.x + cmd.rect.height = cmd.rect.height * cmd.scale.y cmd.rect = worldToScreenRect(cmd.rect, camera) renderer_commands.push({