-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gamepad support? #34
Comments
Nothing planned. By all means feel free to put together a pull request. |
Ok! I'll start to specify interfaces based on html5 gamepad API and lwjgl Controller* classes. I saw that a google CLA notice in CONTRIBUTORS file. Is it still needed since Threerings took over playn development and it looks like google is not involved anymore? Should I signed a CLA for Threerings? Just add my name to CONTRIBUTORS? Use a very liberal license (MIT?) that allows sublicensing and let you use whatever you want? |
I started the API specs and lwjgl based implementation last night: https://github.com/devnewton/playn/commit/1f5605f6b5fd52e17d410bba81d998086d497cae |
I made the lwjgl/jinput based gamepad support work. I started html implementation, but gwt compiler put a lot of "null.nullMethod();" instead of methods calls. I cannot figure why... |
The general API looks reasonably as does the LWJGL implementation. I'm curious as to how dual axis controllers are exposed via this API. Is 0,1 up/down left/right for the first analog stick and then 2,3 up/down left/right for the second? It would be nice to be a bit more explicit about that, particularly if different backends make different assumptions. Also, you should not use Java logging in the JavaGamepads init method. Just have JavaGamepads take a JavaPlatform instance (and save it), and use platform.log().warn(...) to issue the warning. |
Re: null.nullMethod(): that usually happens when GWT can prove that something will always be null, so you are probably failing to initialize a field somewhere or something. |
I have trouble to find a portable way to do this:
I also encountered a lot of html5 API problems (no way to retrieves dead zones, on Chrome default axis values are -1, something the gamepad array list contains undefined items...). I'll remove the Java logging uses and prepare a cleaner pull request soon. |
Ugh, sounds like a mess. I'm a little wary of providing a cross-platform API for game pads when we're not actually able to provide consistent behavior across platforms. If each platform is so full of idiosyncrasies that one has to test on all platforms they plan to support and hack in workarounds to the different types of behavior, I'd rather not provide a cross-platform API and have developers just access the native APIs in their bootstrap code because then they are forced to read the underlying platform documentation, see how it works and test what they are using. If they're going to have to do that anyway, I'd rather save them the frustration of first writing code against an API that is either totally vague or lies to them about how it behaves, and then discover that it doesn't do what they expect and they have to test on all platforms and hack in workarounds. |
We can split Gamepad support in the following issues:
With lwjgl controller API, html5 gamepad API and from what I've read about Android and iOS controller API, it is possible to provides a cross platform API for 1. For 2 & 3 features some platform provides needed data, some don't. We can just do nothing or expose them as optional features (like sync i/o operations in Assets playn interface). 1 is enough to add gamepad input to a game configurable in "options menu". I think this will please 99% players. |
Sounds good! |
Any news on this one? |
Hello samskivert, I saw that you talked about my pull request on the playn google group. I'm replying here, because I don't have a google account.
What do you mean? What is incompatible? Both API provide ways to enumerate gamepads and query button and axis states. (Libgdx is doing the same kind of abstraction between desktop, android and html5 controller API). |
Is gamepad support planned for playn?
I can propose an API and work on java and html implementation...
The text was updated successfully, but these errors were encountered: