Gamepad / Controller Support - OSX / PC / Mobile

Hey All,

I’m wondering what the status is on adding gamepad support for Mac and PC?
I noticed this feature request for v3.2: http://cocos2d-x.org/issues/4689 - Is that going to be for Mac and PC or just mobile?

Thanks

1 Like

I will support mobile phones and TV that using Android system, such as Amazon TV.

I see, ok thanks.

Hi zhangxm,

I looked into this a bit more and was able to add desktop controller support using cocos2d-x v3’s use of GLFW.
I wasn’t able to get the latest cocos2d-x from git compiling in my environment, so I made my changes against 3.1alpha1 instead.

Attached is a patch file to apply to the cocos2d-x directory for adding Joystick support. Note that I added GLFW joystick support in a very basic way since I don’t yet have time to deal with key mappings.
GLFW docs: http://www.glfw.org/docs/latest/group__input.html#gac8d7f6107e05cfd106cfba973ab51e19

Maybe somebody can use my patch file as a starting point to adding official joystick support for the desktop.

@Sheado
Thanks.
About the issue that you can not run latest cocos2d-x, i think you should read README.md, you should run download-deps.py to download dependent libs.

Thanks. download-deps.py helped, but the main reason I couldn’t compile was because Matrix and Vector2 are gone.
My test environment requires those, so I’d like to wait until the next version of cocos2d-x is completed before I try to update my code.

Hi,

Just an update - I updated my GLFW joystick patch to work with v3.1.1
Latest info is here: http://cocos2d-x.org/issues/4689
Sorry, I still haven’t had a chance to make a proper pull request.

@zhangxm Hey Mingo - has this feature been added in the release version 3.4? :smiley:

Not yet.
It is in plan, but is low priority.

I’m working on this for v2.x if anyone needs it.

Hey @corytrese,

In case it helps, I got it working with PS3 and Xbox 360 controller for PC/Mac/Linux here:

It’s not completely polished yet, but it works - maybe it’ll be helpful to you in v2.x
To anybody wondering about v3.x, I’m getting a pull request together. In the meantime, you can get the latest at the branch linked above.

1 Like

@Sheado So this works with verision 3.x? :open_mouth: Wow Nice!!! PLs pls pls. :smiley:

ALso looks like you are testing linux for 3.x. Will it work with OSX and Windows as of yet? Is there a sample project or tutorial to follow to see how to implement it? THX a ton.

Also do I need to download the following two steps to update the project? As the repo is around 80 mb only. So what additional steps need to be taken to build without errors. Sry git noob here :smiley:

I ran download deps. BUt update -init gave errors :expressionless:

After cloning the repo, please execute download-deps.py to download and install dependencies.

$ cd cocos2d-x
$ python download-deps.py
After running download-deps.py.

$ cd cocos2d-x
$ git submodule update --init

HI. I would like to develop the game for MacOSX, WIndows and LInux so that I can release a port on Steam. I think this is an essential feature. I know Cocos2d-x main focus is mobile but with Steam really opening up new avenues for monetization why is this low priority. With all other framworks going free I think desktop centric featuters is required to stay competitive. You thoughts??!??

OK Got it to work!!! ;D. Tested on the Mac with 360 Controller!!!

I have one small nitpick. While playing if I disconnect the controller and connect it again the game doesnt recognize that the controller reconnected. Is there a workaround?

Also have you tested with XBoxOne and PS4 controller?!??

@siddharthshekar
Yep, it may be great if cocos2d-x has as many features as possible, but we are limited with human resources. Adding a feature is easy, but maintain it for all versions is not easy. Take controller for example, cocos2d-x now even not support Xbox and PS4 now, don’t support steam now.

I think it is better to support it as a package. We are implementing package manager. It will manage all packages that implement extra features of cocos2d-x.

Welll yes that is true. Esp since the feature is not developed by you initially. I understand. Well xboxOne and PS4 support is not there but atleast you have for PC and Mac so that people can release it on steam.

Instead of working on version 4.0 of Cocos2d-x I think it is better if you work on improving 3.x you have spent all this time in developing this version and I think you need to spend more time and human effort in supporting and expanding this version.

This is my opinion anyway. :smiley:

We will continue to maintain v3, of course.
All bugs fixed will be included in v3 and v4.
v3 will continue to add 3d features too.

@zhangxm: That is great. I like the Cocos2d-x team for the that alone. You support backward compatibility. But I dont understand the need to go 3D now. I feel cocos2d-x should focus on 2D framework and make it better with cross platform support instead of branching out into 3D. I definitely am not complaining about the 3D :smiley: but feel that 2D is coco2d-x’s core strength and all effort needs to be put to make it a well rounded 2d framework. Once that is achieved we can always go 3D. It is just one more axis after all ;).

@siddharthshekar
Thanks for your suggestion. We are moving to 3d is that, in Chinese market, 3d requirement is strong.

@zhangxm OK! Now I see the importance of 3D. Thanks for sharing the insight. I really appreciate you open mindedness.