Sha256: a234b1ebf860411663933aede46a5a4606bef8319ad1290bd6c50c079828d1cb

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

class AuthorEngine
  class Part
    module Input
      BUTTONS = {
        "left" => Gosu::KbLeft,
        "right" => Gosu::KbRight,
        "up" => Gosu::KbUp,
        "down" => Gosu::KbDown,
        "x" => Gosu::KbX,
        "y" => Gosu::KbC,
      }
      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
author_engine-0.3.1 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.3.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.1.0 lib/author_engine/game/parts/input.rb