From 45205e1dc718baa4e52e2a36eb10c4e7731bd484 Mon Sep 17 00:00:00 2001 From: Aviv Beeri Date: Wed, 15 Mar 2023 07:42:39 +0000 Subject: [PATCH] Added drawFrom convenience method --- docs/modules/graphics.md | 4 ++-- src/modules/image.wren | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/graphics.md b/docs/modules/graphics.md index cf926bee..0c5c7dd8 100644 --- a/docs/modules/graphics.md +++ b/docs/modules/graphics.md @@ -300,10 +300,10 @@ Draw tile `index` on the spritesheet at location `(x, y)` on screen. Draw tile `index` on the spritesheet at location `(x, y)` on screen. This will also apply the given transform `parameterMap` to the tile being drawn. You can reference the `ImageData.transform` documentation for a list of available parameters. -#### `draw(tileX: Number, tileY: Number, x: Number, y: Number)` +#### `drawFrom(tileX: Number, tileY: Number, x: Number, y: Number)` Draw tile `(tileX, tileY)` on the spritesheet at location `(x, y)` on screen. -#### `draw(tileX: Number, tileY: Number, x: Number, y: Number, parameterMap)` +#### `drawFrom(tileX: Number, tileY: Number, x: Number, y: Number, parameterMap)` Draw tile `(tileX, tileY)` on the spritesheet at location `(x, y)` on screen. This will also apply the given transform `parameterMap` to the tile being drawn. You can reference the `ImageData.transform` documentation for a list of available parameters. diff --git a/src/modules/image.wren b/src/modules/image.wren index 9a2a2115..5df9744d 100644 --- a/src/modules/image.wren +++ b/src/modules/image.wren @@ -167,8 +167,8 @@ class SpriteSheet { return _cache[s] } - draw(sx, sy, x, y, modMap) { draw(sy * _width + sx, x, y, modMap) } - draw(sx, sy, x, y) { draw(sy * _width + sx, x, y) } + drawFrom(sx, sy, x, y, modMap) { draw(sy * _width + sx, x, y, modMap) } + drawFrom(sx, sy, x, y) { draw(sy * _width + sx, x, y) } draw(s, x, y) { draw(s, x, y, null) } draw(s, x, y, modMap) { getTile(s).modify(modMap || {