Tesselode wrote: If you find a good solution, let me know!
sure!
well.. I had bad times with Tactile recently.
It seems that all the pressed() methods return
true on start.
So, I had to add an extra update in the beginning of my game states.
Code: Select all
Control1.fire:update()
Control1.jump:update()
Or else I got insta-pressed buttons.
I use main
love.update() and update all the tactile stuff there.
But also I use some hump/gamestate stuff.
And it seems to run BEFORE the main love.update() function.
I cannot dig deeper now - working on my project very hard.
Just wanted to tell u.
And thank u for a nice Tactile. It saves my time somehow )
Now adding some pull requests of missing GamePads GUIDs and key mappings into the open source DB gamecontrollerdb.txt
I dont know what to do with unknown gamepads now. Probably I have to bind all the used in the project buttons to the GUID
and tell the player to change the keys...
----
UPDATE:
Also had problems with getHat (D-PAD directions input).
My first thought was modding your lib,
Code: Select all
function tactile.gamepadHat(num, hat)
end
but instead I'm writing a detector for D-PAD. Or I'd better wrap it to emulate an Axis... Yeah
UPDATE2:
ok. the 1st version works fine:
Code: Select all
local function gamepadHat(num, hat, axis)
if axis == "horizontal" then
return function()
local joystick = love.joystick.getJoysticks()[num]
local h = joystick:getHat(hat)
if h == "l" or h == "lu" or h == "ld" then
return -1
elseif h == "r" or h == "ru" or h == "rd" then
return 1
end
return 0
end
else
return function()
local joystick = love.joystick.getJoysticks()[num]
local h = joystick:getHat(hat)
if h == "u" or h == "ru" or h == "lu" then
return -1
elseif h == "d" or h == "rd" or h == "ld" then
return 1
end
return 0
end
end
end
- num - joysick nuber
hat - number of the nad (usually 1, or use Joystick:getHatCount() )
axis - "horizontal" or "vertical"
then add it as an axis:
Code: Select all
:addAxis(gamepadHat(1, 1, "horizontal"))
Code: Select all
:addAxis(gamepadHat(1, 1, "vertical"))
It works. Back to the coding ))
Tesselode, it would be nice if u add DPAD / HAT support into the lib. ^_-
You'll have to add your common checks if there is a joystick. And whether there is a hat.