I would like to know if it’s possible to use a ScreenController as a Gamepad/Joystick, so I can handle it with the onAnalog method.
I want to create a HUD with anolog controls on a touch screen. Something like in “Leo’s RC Simulator (Android)”.
I hope it’s a little bit clear from this post.
Thanks in advance.
There is no reason to go through the InputManager for this (nor is it possible). Just hook up your screen controller to call your analog listener directly.
Thank for the quick answer. I’m going to try it this week.
The analog listener doesn’t do anything with output -to- the controller though. If you want to do something like rumble I’d say have a look at jinput
The analog listener doesn't do anything with output -to- the controller though. If you want to do something like rumble I'd say have a look at jinput
Or he could try the methods on InputManager for doing that. The android device through InputManager simulates a joystick already (with tilt), though I don't know what the status of rumble is.
Vortex is talking about something entirely different, though. He wants to simulate a joystick with an on-screen control.
The solution from pspeed with calling the analog listener directly worked.
Rumble on Android is functional. Take a look at the javadoc in AndroidSensorJoyInput.java to see how to do it.
If you set joystickEventsEnabled = true; in MainActivity, Android will create a Joystick that uses the device orientation/rotation/tilt as the joystick axes. However, if you do not create any mappings in InputManager, then you will not use the feedback from the device tilt, but still have access to the joystick.rumble method. It will cause the device to vibrate based on the rumble amount set.