Module: AuthorEngine::Part::GosuInput

Included in:
Game
Defined in:
lib/author_engine/game/gosu/parts/input.rb

Constant Summary collapse

BUTTONS =
{
  "left" => Gosu::KbLeft,
  "right" => Gosu::KbRight,
  "up" => Gosu::KbUp,
  "down" => Gosu::KbDown,
  "x" => Gosu::KbX,
  "y" => Gosu::KbC,
}

Instance Method Summary collapse

Instance Method Details

#button?(name) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/author_engine/game/gosu/parts/input.rb', line 12

def button?(name)
  down = false

  if BUTTONS.dig(name)
    down = Gosu.button_down?(BUTTONS.dig(name))
  else
    raise "Button '#{name}' not found!"
  end

  return down
end