Question

I am overwritting the default paint method, and everything is working fine. I have a running game in CodenameOne (plays smooth, everything works), but the downside is: I had to use buttons for player movement. I would like to use "swipe" gestures, which is in itself a relatively simple implementation. However, when I swipe on the screen, what is painted gets removed, so I am left with just the background (for a split second, the paint continues when releasing the drag).

Any idea on how to fix this issue - without overriding the behaviour of touch gestures?

Was it helpful?

Solution

You shouldn't override paint in Form, it has some special cases. The best workaround is to create a component and place it in a BorderLayout.CENTER in the Form.

OTHER TIPS

A solution I have at the moment is the following. Everything still seems to work!

public void pointerDragged(int x, int y)
{
    System.out.println("This shouldn't do anything");
}

public void pointerDragged(int[] x, int[] y) 
{
    System.out.println("This shouldn't do anything either");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top