I'm having problems with the joystick api. I'm using a set of drivers for connecting my PS3 pad to Windows xp (http://www.motioninjoy.com/) and all buttons/axes are detected in windows control panel.
My love.load function initialise joystick 1 like so
Code: Select all
p1_joystick_data = {};
p1_joystick_data.id = 1;
p1_joystick_data.num_axes = nil;
function love.load()
print("Init love.load()");
joysticks = love.joystick.getNumJoysticks();
print("There are " .. tostring(joysticks) .. " available");
if(joysticks < 1) then return end;
print("Name:" .. tostring(love.joystick.getName(p1_joystick_data.id)));
print("Open? " .. tostring(love.joystick.isOpen( p1_joystick_data.id )));
while(love.joystick.isOpen( p1_joystick_data.id ) == false)do
local result = love.joystick.open( 1 );
print("result " .. tostring(result));
end
print("Open? " .. tostring(love.joystick.isOpen( p1_joystick_data.id )));
p1_joystick_data.num_axes = love.joystick.getNumAxes( p1_joystick_data.id );
print("num_axes: " .. tostring(p1_joystick_data.num_axes))
end
however it fails to open the joystick and loops in while loop.
Can anyone offer help please?
thanks.