summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorTom Black <[email protected]>2021-04-26 19:33:08 -0500
committerTom Black <[email protected]>2021-04-26 19:33:08 -0500
commit2f194a30ff9d6cdf281d35c3b7b93182436650d2 (patch)
tree793669c629a2222b01f6e11e8670448f7eba9c51 /lib
parent426f677cb4c1543c62f0a1eafba34777c6525646 (diff)
downloadruby2d-direct-draw.tar.gz
ruby2d-direct-draw.zip
Direct draw imagesdirect-draw
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