-
Notifications
You must be signed in to change notification settings - Fork 43
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
joystick or controls #135
Comments
Uh, haven't seen the code for quite some time :) But here goes:
ActorController::Update Implement custom logic based on the key which is being handled.
Someone added some "alternate" controls via some pull request which enabled controlling of claw via WASD and shotting/attack through mouse buttons. This is distinguished by e.g. this line: https://github.com/pjasicek/OpenClaw/blob/master/OpenClaw/ActorController.cpp#L55 Hope this helps. |
Thanks to see if I understand, I am not clear how to do the config.xml file, I use linux and see that there is a config file linux the line would be something like this? (SDL_GetScancodeFromKey(key) == SDL_SCANCODE_LALT || SDL_GetScancodeFromKey(key) == SDL_CONTROLLER_BUTTON_A ) |
Well I looked at the "Controller" abstraction code by SDL and it is not that simple at all. Game Controller input is handled by a different subsystem so it is handled differently than keyboard. You can look here for more details: http://lazyfoo.net/tutorials/SDL/19_gamepads_and_joysticks/index.php In the engine startup routine you would have to add initialization of the SDL Game Controller and keep the reference to the controller somewhere in the g_pApp. Then when processing input you would have to check for any game controller events and handle them accordingly. |
Here are 3 commits for my basic implementation of controller support: https://github.com/mialy/OpenClaw/commits/controllers I'm really bad at C/C++, and what stops me even more is I was unable run build on Windows with Visual Studio (Linux works though) . Still, implementation supports Xbox One S controller + some other NES-like, but with fixed buttons, meaning if button "1" in your controller is identified as "menu" and not "A" or "X" button, you have bad luck. My plan was to implement key mapping in C# launcher, but now I haven't much time. |
If I connect my joystick is activated the menu controls? or just activates the buttons automatically? |
Is it possible to change the controls or use a joystick?
what would be the proper way to include SDL_joystick in the ActorController.cpp and .h file?
The text was updated successfully, but these errors were encountered: