summaryrefslogtreecommitdiffhomepage
path: root/docs/todo
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2021-12-10 00:09:48 -0600
committerAmir Rajan <[email protected]>2021-12-10 00:09:48 -0600
commiteaa29e72939f5edf61735ccbb73c36ee89369f65 (patch)
treec310fac2e39bd799bf7fc1f73d35c12bcc5187b7 /docs/todo
parent33dfdde9ae03e3218b4796f3595d3b727f626587 (diff)
downloaddragonruby-game-toolkit-contrib-eaa29e72939f5edf61735ccbb73c36ee89369f65.tar.gz
dragonruby-game-toolkit-contrib-eaa29e72939f5edf61735ccbb73c36ee89369f65.zip
Synced with DragonRuby Game Toolkit v3.2.
Diffstat (limited to 'docs/todo')
-rw-r--r--docs/todo/05-sprites.md20
1 files changed, 16 insertions, 4 deletions
diff --git a/docs/todo/05-sprites.md b/docs/todo/05-sprites.md
index e2be250..e8030ab 100644
--- a/docs/todo/05-sprites.md
+++ b/docs/todo/05-sprites.md
@@ -179,14 +179,26 @@ args.outputs.sprites << {
## Duck Typing (Advanced)
-You can also create a class with sprite properties and render it as a primitive,
-using the `attr_sprite` helper.
+You can also create a class with sprite properties and render it as a primitive.
+ALL properties must on the class. ADDITIONALLY, a method called `primitive_marker`
+must be defined on the class.
Here is an example:
```ruby
-class PlayerSprite
- attr_sprite
+# Create type with ALL sprite properties AND primitive_marker
+class Sprite
+ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :source_x,
+ :source_y, :source_w, :source_h, :flip_horizontally,
+ :flip_vertically, :angle_anchor_x, :angle_anchor_y
+
+ def primitive_marker
+ :sprite
+ end
+end
+
+# Inherit from type
+class PlayerSprite < Sprite
# constructor
def initialize x, y, w, h