lib/gamebox/core/input_manager.rb
# autohook a boolean to be set to true while any of the keys are pressed
autohook a boolean to be set to true while any of the keys are pressed
autohook a boolean to be set to true while any of the keys are pressed
def while_pressed(id_or_ids, target, accessor)
    ids = [id_or_ids].flatten
    ids.each do |id|
      _register_hook target, :down, id do
        target.send "#{accessor}=", true
      end
      _register_hook target, :up, id do
        target.send "#{accessor}=", false if (@down_ids.keys & ids).size == 0
      end
    end
  end
def while_pressed ( id_or_ids , target , accessor ) ids = [ id_or_ids ] . flatten ids . each do | id | _register_hook target , :down , id do target . send "#{accessor}=" , true end _register_hook target , :up , id do target . send "#{accessor}=" , false if ( @down_ids . keys & ids ) . size == 0 end end end
autohook a boolean to be set to true while any of the keys are pressed
autohook a boolean to be set to true while any of the keys are pressed
id_or_ids
<not_specific>
target
<not_specific>
accessor
<not_specific>