This is a modified work of: https://code.google.com/p/mobile-anarchy-widgets/
for use with Godot Engine
Recompile the Java Android project (https://github.com/okamstudio/godot/wiki/compiling_android)
To enable the module on Android, add the path to the module to the "modules" property on the [android] section of your engine.cfg file. It should look like this:
[android]
modules="com/android/godot/GodotAnalogJoy"
Note this is a comma separated list inside a string, you can have other modules there.
The singleton "AnalogJoy" will be available on gdscript.
The following methods are available:
void ShowJoy();
void HideJoy();
int GetLeftPan();
int GetLeftTilt();
int GetRightPan();
int GetRightTilt();
bool LeftReleased();
bool LeftReturned();
bool RightReleased();
bool RightReturned();
The joystick is initialized on godot opening but doesnt show (only after a resume). So we need to hide from a GDScript!
After, we only need to show or hide when needed!