module R2D::Helpers

Public Instance Methods

key_down(key, &block) click to toggle source
# File lib/r2d/helpers.rb, line 22
def key_down(key, &block)
  @current.add_key_down(key, block)
end
key_down?(key) click to toggle source
# File lib/r2d/helpers.rb, line 18
def key_down?(key)
  @current.key_down?(key)
end
mouse_x() click to toggle source
# File lib/r2d/helpers.rb, line 6
def mouse_x
  Adapters.mouse_x
end
mouse_y() click to toggle source
# File lib/r2d/helpers.rb, line 10
def mouse_y
  Adapters.mouse_y
end
on_key(key, &block) click to toggle source
# File lib/r2d/helpers.rb, line 14
def on_key(key, &block)
  @current.on_key(key, block)
end
update(&block) click to toggle source
# File lib/r2d/helpers.rb, line 26
def update(&block)
  @current.update(block)
end
window(opts={}) click to toggle source
# 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