Sha256: 75a10b64f43d306c851fd2352bce97c266e8ebcfde273f3e1a1572d75b149d62

Contents?: true

Size: 505 Bytes

Versions: 7

Compression:

Stored size: 505 Bytes

Contents

class AuthorEngine
  class Part
    module GosuInput
      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

7 entries across 7 versions & 1 rubygems

Version Path
author_engine-0.9.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.8.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.7.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.6.1 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.6.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.5.0 lib/author_engine/game/gosu/parts/input.rb
author_engine-0.4.0 lib/author_engine/game/gosu/parts/input.rb