Class: Dare::Image
- Inherits:
-
Object
- Object
- Dare::Image
- Defined in:
- lib/dare/window.rb
Instance Method Summary collapse
- #draw(x = 0, y = 0) ⇒ Object
-
#initialize(window, path = "") ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(window, path = "") ⇒ Image
Returns a new instance of Image.
115 116 117 118 119 |
# File 'lib/dare/window.rb', line 115 def initialize(window, path = "") @img = `new Image()` `#{@img}.src = #{path}` @window = window end |
Instance Method Details
#draw(x = 0, y = 0) ⇒ Object
120 121 122 |
# File 'lib/dare/window.rb', line 120 def draw(x = 0, y = 0) `#{@window.canvas.context}.drawImage(#{@img},#{x},#{y})` end |