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
boipushy (Input handling)
boipushy (Input handling)
Last edited by adnzzzzZ on Sat Apr 15, 2017 10:35 am, edited 5 times in total.
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: Thomas
So clean and easy! Nice library, I will sure use it for my projects.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [Library] Thomas
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)
Re: [Library] boipushy (Input handling)
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
Re: [Library] boipushy (Input handling)
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)?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: [Library] boipushy (Input handling)
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.
Re: [Library] boipushy (Input handling)
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?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: [Library] boipushy (Input handling)
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.
Re: [Library] boipushy (Input handling)
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.
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.
Who is online
Users browsing this forum: No registered users and 3 guests