Sha256: dbad9978d9507e8cfaf82610080cffa2b34afc6c7e1dcfbbb3766d9dbca3b48a

Contents?: true

Size: 640 Bytes

Versions: 7

Compression:

Stored size: 640 Bytes

Contents

# Convenience module to set up an InputController
module Lotu
  module Controllable

    def self.extended(instance)
      instance.init_behavior
    end

    def init_behavior
      @input_controller = nil
    end

    # This will call #go_up every game loop
    # Gosu::Button::KbUp => :go_up
    # This is the same as the above
    # Gosu::Button::KbUp => [:go_up, 0]
    #
    # This will call #go_up once
    # Gosu::Button::KbUp => [:go_up, false]
    #
    # This will call #go_up every 50ms
    # Gosu::Button::KbUp => [:go_up, 50]
    def set_keys(keys)
      @input_controller = InputController.new(self, keys)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lotu-0.1.9 lib/lotu/behaviors/controllable.rb
lotu-0.1.7 lib/lotu/behaviors/controllable.rb
lotu-0.1.6 lib/lotu/behaviors/controllable.rb
lotu-0.1.5 lib/lotu/behaviors/controllable.rb
lotu-0.1.4 lib/lotu/behaviors/controllable.rb
lotu-0.1.3 lib/lotu/behaviors/controllable.rb
lotu-0.1.2 lib/lotu/behaviors/controllable.rb