It is time to make use of the multi-touch facilities and emulate a gaming console-like interface on an Android device touch screen.
Learn how to handle multi-touch input from recipes Processing multi-touch events on Android and Processing multi-touch events on Windows before proceeding with this recipe.
We implement a custom multi-touch event handler, which keeps track of all the touch points. The joystick is rendered as a full-screen bitmap shown on the left-hand side. When the user touches the screen, we use the touch coordinates to fetch the pixel color from the mask on the right-hand side of the figure. Then, we find the internal button corresponding to the color and change its