문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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");
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top