summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/image.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb
index 67ce1b1..ecaeb53 100644
--- a/lib/ruby2d/image.rb
+++ b/lib/ruby2d/image.rb
@@ -26,5 +26,28 @@ module Ruby2D
add
end
+ def draw(opts = {})
+ opts[:width] = opts[:width] || @width
+ opts[:height] = opts[:height] || @height
+ opts[:rotate] = opts[:rotate] || @rotate
+ unless opts[:color]
+ opts[:color] = [1.0, 1.0, 1.0, 1.0]
+ end
+
+ self.class.ext_draw([
+ self, opts[:x], opts[:y], opts[:width], opts[:height], opts[:rotate],
+ opts[:color][0], opts[:color][1], opts[:color][2], opts[:color][3]
+ ])
+ end
+
+ private
+
+ def render
+ self.class.ext_draw([
+ self, @x, @y, @width, @height, @rotate,
+ @color.r, @color.g, @color.b, @color.a
+ ])
+ end
+
end
end