TLbind 1.3 - professional controls made easy (now w/ mouse!)
Re: TLbind - making professional control schemes easy
Put me on your small dingy of non-conformity.
Re: TLbind - making professional control schemes easy
Awesome library! I was going to roll my own solution, but yours is a lot simpler.
I've found some really weird behavior that I think is related to having only keyboard or only joystick input enabled. I've thrown together a quick test LÖVE program to show what I'm talking about, as well as some fixes.
https://gist.github.com/1744602
The program basically just dumps input info to the screen. On control press, the relevant control text flashes green for one frame, and red on control release. I have it set up with one "player" who uses the keyboard, and one who uses a joystick, using two separate instances of TLbind.
The keyboard-only player does not have any analog inputs, but "left" and "right" are mapped to the "horizontal" analog, and same with up/down/vertical. With TLbind v1.07, releasing a direction does not actually register.
The joystick-only player has analog inputs and hats, which bring their own oddities. Up/down/left/right/horizontal/vertical do not trigger key presses or releases at all, though their values change. Also, up/down/left/right are set to nil instead of false on release.
I included a TLbind_custom.lua which solves the above problems*. See what you think!
*I also cleared out the default bindings, which shouldn't affect anything. Seems kind of weird to me to include game-specific example defaults straight in the middle of the library source, though... End users (like me!) shouldn't have to edit the library source imho.
I've found some really weird behavior that I think is related to having only keyboard or only joystick input enabled. I've thrown together a quick test LÖVE program to show what I'm talking about, as well as some fixes.
https://gist.github.com/1744602
The program basically just dumps input info to the screen. On control press, the relevant control text flashes green for one frame, and red on control release. I have it set up with one "player" who uses the keyboard, and one who uses a joystick, using two separate instances of TLbind.
The keyboard-only player does not have any analog inputs, but "left" and "right" are mapped to the "horizontal" analog, and same with up/down/vertical. With TLbind v1.07, releasing a direction does not actually register.
The joystick-only player has analog inputs and hats, which bring their own oddities. Up/down/left/right/horizontal/vertical do not trigger key presses or releases at all, though their values change. Also, up/down/left/right are set to nil instead of false on release.
I included a TLbind_custom.lua which solves the above problems*. See what you think!
*I also cleared out the default bindings, which shouldn't affect anything. Seems kind of weird to me to include game-specific example defaults straight in the middle of the library source, though... End users (like me!) shouldn't have to edit the library source imho.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: TLbind - making professional control schemes easy
Thank you! That's why I release my libraries.smrq wrote:Awesome library! I was going to roll my own solution, but yours is a lot simpler.
I've reviewed your improvements, and they are good. You not only fixed these bugs which have somehow slipped past me (how they heck did they do that, I use this library all the time!?), but you even made everything behave the way I envisioned. Nicely done. I would be happy to add them to the official TLbind library, if you're amenable to this (you'd get credit, of course).
I put that there for three reasons. First, they're decent defaults for most 2D games (the directional stuff, at least. The first two buttons mainly just needed names, so I chose generic, common ones). Two, they're a working example of how to set binds. Three, it's a handy reference for what axes and buttons enumerate to on an XBox 360 gamepad, the "official" Windows gamepad (and most all gamepad-capable games on PC cater to, both professional and indie).smrq wrote:*I also cleared out the default bindings, which shouldn't affect anything. Seems kind of weird to me to include game-specific example defaults straight in the middle of the library source, though... End users (like me!) shouldn't have to edit the library source imho.
That being said, you also have a point. So what if, as a compromise, I keep my default example there, but commented out?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: TLbind - making professional control schemes easy
Isn't that more something for in the documentation than in the library source, even if commented out?Taehl wrote:I put that there for three reasons. First, they're decent defaults for most 2D games (the directional stuff, at least. The first two buttons mainly just needed names, so I chose generic, common ones). Two, they're a working example of how to set binds. Three, it's a handy reference for what axes and buttons enumerate to on an XBox 360 gamepad, the "official" Windows gamepad (and most all gamepad-capable games on PC cater to, both professional and indie).smrq wrote:*I also cleared out the default bindings, which shouldn't affect anything. Seems kind of weird to me to include game-specific example defaults straight in the middle of the library source, though... End users (like me!) shouldn't have to edit the library source imho.
That being said, you also have a point. So what if, as a compromise, I keep my default example there, but commented out?
Help us help you: attach a .love.
Re: TLbind - making professional control schemes easy
Cheers! I just don't want to have to maintain my own fork of the library Go right ahead!Taehl wrote:I would be happy to add them to the official TLbind library, if you're amenable to this (you'd get credit, of course).
Good enough for me, but...Taehl wrote:So what if, as a compromise, I keep my default example there, but commented out?
I agree with that sentiment. An end user isn't going to look into the library source unless something is wrong. It would be a lot more useful just to have that information in the docs, since that's what users are actually going to be reading when they get started with the library. Just my 2 cents.Robin wrote:Isn't that more something for in the documentation than in the library source, even if commented out?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: TLbind - making professional control schemes easy
Thanks, smrq. I added your improvements, a tiny bug fix, and a few minuscule optimizations (turns out that if statements are slightly faster than short-circuit evaluations of equal size. Who would have guessed?). Don't worry, it still passes your test just fine.
TLbind is now v1.1. Download link is still here.
TLbind is now v1.1. Download link is still here.
Maybe I'm biased by all my experiences of being cut off from the 'net...Robin wrote:Isn't that more something for in the documentation than in the library source, even if commented out?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: TLbind - making professional control schemes easy
Fair enough. Though I was thinking more of a README file than a website for documentation.Taehl wrote:Maybe I'm biased by all my experiences of being cut off from the 'net...
Help us help you: attach a .love.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: TLbind - making professional control schemes easy
I hope you don't mind if I intrude on this conversation.
I believe the best option is a README and, when needed, a small sample app. Lately I have been adding a "demo" app to all my libs on github just for this.
I believe the best option is a README and, when needed, a small sample app. Lately I have been adding a "demo" app to all my libs on github just for this.
When I write def I mean function.
Re: TLbind - making professional control schemes easy
This is really cool
Any plans to allow multiple controllers for local multiplayer games?
Any plans to allow multiple controllers for local multiplayer games?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: TLbind - making professional control schemes easy
Not at all. That's not a bad idea, actually. I think I'd do that if I wasn't in the middle of a bunch of other things right now.kikito wrote:I hope you don't mind if I intrude on this conversation.
I believe the best option is a README and, when needed, a small sample app. Lately I have been adding a "demo" app to all my libs on github just for this.
Thanks!hughes wrote:This is really cool
Any plans to allow multiple controllers for local multiplayer games?
That capability is already there. If you like programming in procedural style, then you just assign some controls for things like "p1left", "p2left", and so forth, and have your game logic do stuff with that. In OO style, you can give each player object its own TLbind object. Smrq's test shows one way to do it (don't use the version of TLbind in there, though, it's outdated). Check out the TLbind documentation on the wiki (all of my libraries are documented there).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Who is online
Users browsing this forum: No registered users and 1 guest