How do you create your own controller?

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
dspcincozo
Prole
Posts: 2
Joined: Tue Apr 07, 2015 4:35 pm

How do you create your own controller?

Post by dspcincozo »

Hello everyone,

First post so forgive me if the formatting isn't correct. I am making a game right now in which I am using an arduino and some floor sensors to act as the controller. I've got it working (kind of) using UDP send/receive packets from Processing ---> love2d. My issue here is that it doesn't work all the time and sometimes it isn't as responsive as I would like it to be. There has to be an easier way to do this. I've got 4 "buttons" that are triggered by weight sensors (a reading from 0-1025, 500 or so being "on"). All i need is an on/off state.

I've seen that there is a "joystick" function but I haven't seen anything where I can set up my buttons to act as a button. Hopefully this is something super obvious that I have looked over.

Any suggestions how I can get this to work more efficiently would be greatly appreciated.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: How do you create your own controller?

Post by T-Bone »

Löve relies on SDL for things like these, so if you can make your Arduino be identified by SDL as a controller, you're good to go. Finding info about that might be easier, since SDL is more commonly used than Löve.

I also know that, from within Löve's source code, it's possible to "hack" things to be registered as controllers by Löve. The Android and iOS ports use this to make the accelerometer available as a controller. So if you can make the input available without lag in C++, you can probably hack it together if you're ready to modify Löve's source code.

Hope this helps you a little :)
dspcincozo
Prole
Posts: 2
Joined: Tue Apr 07, 2015 4:35 pm

Re: How do you create your own controller?

Post by dspcincozo »

T-Bone wrote:Löve relies on SDL for things like these, so if you can make your Arduino be identified by SDL as a controller, you're good to go. Finding info about that might be easier, since SDL is more commonly used than Löve.

I also know that, from within Löve's source code, it's possible to "hack" things to be registered as controllers by Löve. The Android and iOS ports use this to make the accelerometer available as a controller. So if you can make the input available without lag in C++, you can probably hack it together if you're ready to modify Löve's source code.

Hope this helps you a little :)
Awesome I will check it out.

Thanks!
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: How do you create your own controller?

Post by s-ol »

It will probably be a lot harder to use the controller interface than hack something together with a DLL/so library. For example you could cut out the Processing middleman and instead open the COM port on it's own: https://github.com/edartuz/lua-serial

The controller interface is meant for Gamepads like PS3 and XBox controllers and they need to be detected by a system driver to work (afaik).

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests