boipushy (Input handling)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

boipushy (Input handling)

Post by adnzzzzZ »

Hi. I've created a library for handling and abstracting away some things about input with LÖVE. It should make it easier to use gamepads, to bind/unbind keys to game actions, and to check for pressed/released calls inside the update loop instead of on callbacks.

boipushy
Last edited by adnzzzzZ on Sat Apr 15, 2017 10:35 am, edited 5 times in total.
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Thomas

Post by master both »

So clean and easy! Nice library, I will sure use it for my projects.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: [Library] Thomas

Post by Roland_Yonaba »

Nice work! Shared on my Twitter :)
Well, I do like the name, also. can you explain how come you named it this way ? :awesome:
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] Thomas

Post by adnzzzzZ »

Updated this with the following:
  • Exposed Input.all_keys variable
  • Fixed a bug with space not being able to be bound accordingly in some situations
  • Added automatic callback registers (meaning you don't need to add each input object to all love callbacks anymore, it does that automatically)
  • Added support for 0.10.0 (but it also still works on >=0.9.1)
https://github.com/adonaac/thomas
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] boipushy (Input handling)

Post by adnzzzzZ »

Updated this with the following:
  • Changed the name to boipushy
  • Made updating implicit, meaning all that has to be done to use an Input object is creating it
https://github.com/adonaac/boipushy
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: [Library] boipushy (Input handling)

Post by T-Bone »

I don't really understand how the bind function works. I guess you can bind buttons to both strings and functions? If you bind to a function, when will it be called (pressed, down and/or up)?
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] boipushy (Input handling)

Post by adnzzzzZ »

Yes. The string you bind it to is an action, such as 'Jump' or 'MoveRight'. This is so you can change key bindings without having to change everywhere that action is triggered (i.e. in code you write if input:pressed('Jump') and if you change the bindings to jump you don't have to go to that if and change it). As for the function, it's just an easy way to get some functionality tied to a key so you don't have to do the check on an update function. And it gets called when the key is pressed.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: [Library] boipushy (Input handling)

Post by T-Bone »

How good is it at understanding different gamepads on different platforms? Can I rely on this working well regardless of what OS and what gamepad the player is using?
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] boipushy (Input handling)

Post by adnzzzzZ »

It's as good as LÖVE is by default (which is as good as SDL is). So far I haven't tested a multitude of controllers but the one I have (DS3) works normally without any setup.
User avatar
Skeiks
Citizen
Posts: 51
Joined: Wed Jan 28, 2015 1:51 pm

Re: [Library] boipushy (Input handling)

Post by Skeiks »

I've been using this library in one of my projects and recently updated it to the new version. The newest version seems to break something in the call backs to the 'keypressed' method, causing Input:pressed() to be called twice, which breaks keypressed events about 90% of the time.

This could be related to how I handle frames (static timestep with an accumulator) or something, but the bindings were a bit above my lua skill level at the moment so I just rolled back to the last version. If I can figure out exactly what's going on I'll try to submit an update.

The library is really slick though. You handled input abstraction very smoothly.
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests