Skip to content

Commit

Permalink
Added drawFrom convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
avivbeeri committed Mar 15, 2023
1 parent 9d8ecf9 commit 45205e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/modules/graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/modules/image.wren
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {
Expand Down

0 comments on commit 45205e1

Please sign in to comment.