module AuthorEngine::Part::OpalInput

Constants

BUTTONS
KEY_STATES

Store key states

Public Instance Methods

button?(name) click to toggle source
# File lib/author_engine/game/opal/parts/input.rb, line 17
def button?(name)
  down = false

  if BUTTONS.dig(name)
    down = KEY_STATES.dig(BUTTONS.dig(name)) # dig returns false if key not found
  else
    raise "Button '#{name}' not found!"
  end

  return down
end