Module: R2D::Helpers
- Defined in:
- lib/r2d/helpers.rb
Instance Method Summary collapse
- #key_down(key, &block) ⇒ Object
- #key_down?(key) ⇒ Boolean
- #mouse_x ⇒ Object
- #mouse_y ⇒ Object
- #on_key(key, &block) ⇒ Object
- #update(&block) ⇒ Object
- #window(opts = {}) ⇒ Object
Instance Method Details
#key_down(key, &block) ⇒ Object
22 23 24 |
# File 'lib/r2d/helpers.rb', line 22 def key_down(key, &block) @current.add_key_down(key, block) end |
#key_down?(key) ⇒ Boolean
18 19 20 |
# File 'lib/r2d/helpers.rb', line 18 def key_down?(key) @current.key_down?(key) end |
#on_key(key, &block) ⇒ Object
14 15 16 |
# File 'lib/r2d/helpers.rb', line 14 def on_key(key, &block) @current.on_key(key, block) end |
#update(&block) ⇒ Object
26 27 28 |
# File 'lib/r2d/helpers.rb', line 26 def update(&block) @current.update(block) end |
#window(opts = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/r2d/helpers.rb', line 30 def window(opts={}) case opts when :show @current.show when :clear @current.clear else @current = Window.new( w: opts[:width] || 640, h: opts[:height] || 480, bg: opts[:background], fs: opts[:fullscreen] || false ) end end |