Sha256: 9d295f54b7b4f774cd149a8488aa1a5fd76076712e0869ab1c26a8628498dd9d
Contents?: true
Size: 798 Bytes
Versions: 3
Compression:
Stored size: 798 Bytes
Contents
module RubySketch module GraphicsContext def sprite(*sprites) sprites.flatten! if sprites.first&.is_a? Array sprites.each do |sp| v = sp.getInternal__ f, angle, img, offset = v.frame, v.angle, sp.image, sp.offset if angle == 0 drawSprite__ f.x, f.y, f.w, f.h, img, offset else pushMatrix do translate f.x, f.y rotate radians(angle) drawSprite__ 0, 0, f.w, f.h, img, offset end end end end def drawSprite__(x, y, w, h, img, offset) if img && offset ox, oy = offset copy img, ox, oy, w, h, x, y, w, h elsif img image img, x, y else rect x, y, w, h end end end# GraphicsContext end# RubySketch
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubysketch-0.5.3 | lib/rubysketch/graphics_context.rb |
rubysketch-0.5.2 | lib/rubysketch/graphics_context.rb |
rubysketch-0.5.1 | lib/rubysketch/graphics_context.rb |