Java Midp 2.0 Touch Screen Games Here
private void updateGame() // Use touchX, touchY, touching for game logic
protected void pointerPressed(int x, int y) playerX = Math.min(Math.max(x, 10), getWidth() - 10); shootRequested = true; java midp 2.0 touch screen games
protected void pointerReleased(int x, int y) touching = false; onTouchUp(x, y); private void updateGame() // Use touchX, touchY, touching
protected void pointerDragged(int x, int y) touchX = x; touchY = y; onTouchDrag(x, y); private void updateGame() // Use touchX
protected void paint(Graphics g) // Draw game, e.g. draw button if touching if (touching) g.setColor(0xFF0000); g.fillRect(touchX-10, touchY-10, 20, 20);
class GameCanvas extends Canvas implements Runnable { private int playerX, playerY; private boolean shootRequested; private boolean running;
protected void pointerDragged(int x, int y) playerX = Math.min(Math.max(x, 10), getWidth() - 10);
