Drivers

Artoo has a extensible system for connecting to hardware devices.

Generic Joystick


Allows user to interact with Artoo devices using any joystick or game controller that is compatible with SDL.

How To Connect

require 'artoo'
connection :joystick, :adaptor => :joystick
device :controller, :driver => :joystick, :connection => :joystick, :interval => 0.1

How To Use

Example receiving button events from a generic joystick.

require 'artoo'

connection :joystick, :adaptor => :joystick
device :joystick, :driver => :joystick, :connection => :joystick, :interval => 0.1

work do
  on joystick, :joystick => proc { |caller, value|
    puts 'joystick ' + value[:s].to_s, value[:x], value[:y]
  }
  on joystick, :button => proc { |*value|
    puts 'button ' + value[1]
  }
end

Events

joystick

Get's triggered every "interval" amount of time if a joystick event occured, you can access values x, y, s.

button

Get's triggered every "interval" amount of time if the button was pressed, you can access the value of the pressed button.

Compatibility