Problem with gamepad input ! No Reaction...

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Lovingsoul1337
Prole
Posts: 32
Joined: Fri Feb 21, 2020 1:26 pm

Problem with gamepad input ! No Reaction...

Post by Lovingsoul1337 »

Hey there i try to implement a joystick class and for some reason no input changes:

local joystick = {}
joystick.__index = joystick
joystick.arrow = love.graphics.newImage('Assets/test_arrow_numberouno.png')
love.joystick.loadGamepadMappings('ControlManager/controllermapping.txt')


function joystick.new()
local self = {}
self.joysticks = love.joystick.getJoysticks()
setmetatable(self, joystick)
return self
end

function joystick:update(dt)

local count = self.joysticks[1]:getAxisCount()

print("Axes")
print(count)

local ak1 = self.joysticks[1]:getAxis(1)
local ak2 = self.joysticks[1]:getAxis(2)
local ak3 = self.joysticks[1]:getAxis(3)
local ak4 = self.joysticks[1]:getAxis(4)
local ak5 = self.joysticks[1]:getAxis(5)
local ak6 = self.joysticks[1]:getAxis(6)

print("Axes:")

print(ak1)
print(ak2)
print(ak3)
print(ak4)
print(ak5)
print(ak6)

if self.joysticks[1]:isGamepadDown("start") then
love.event.quit()
end

for key, value in ipairs(self.joysticks) do
value:setVibration(1 ,1 , 1000)
end
end

--check if any joystick is connected

function joystick:checkJoysticks()
local maxCount = #self.joysticks
if maxCount <= 0 then
love.graphics.print("No Joystick connected !", 0, 0)
return
end
end

--give joystick a id

function joystick:assignID()
for i = 1, #self.joysticks do
love.graphics.print(self.joysticks:getName())
end
end

function joystick:draw()
love.graphics.draw(self.arrow,0, 0)
end

return joystick

Can you may tell me why ? Here is my output --> https://snipboard.io/XaqS52.jpg

Thanks in advance !
Lovingsoul1337
Prole
Posts: 32
Joined: Fri Feb 21, 2020 1:26 pm

Re: Problem with gamepad input ! No Reaction...

Post by Lovingsoul1337 »

Found a way ! I did now use Gamepad Methods and it did work !
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 31 guests