Class: SDL2::Joystick::Balls

Inherits:
Components show all
Defined in:
lib/sdl2/joystick/balls.rb

Overview

Enumerates buttons on a joystick.

Instance Method Summary collapse

Methods inherited from Components

#each, #initialize

Constructor Details

This class inherits a constructor from SDL2::Joystick::Components

Instance Method Details

#[](idx) ⇒ Object

Button accessor via index



17
18
19
20
21
# File 'lib/sdl2/joystick/balls.rb', line 17

def [](idx)
  dx, dy = SDL2::TypedPointer::Int.new, SDL2::TypedPointer::Int.new                
  SDL2::joystick_get_ball(@joystick,idx, dx, dy)
  [dx.value, dy.value]       
end

#countObject

How many buttons are there?



11
12
13
# File 'lib/sdl2/joystick/balls.rb', line 11

def count
  SDL2::joystick_num_balls(@joystick)
end