2.0 Touch Screen Games | Java Midp
Use timestamps: record press time, check in update loop. 5. Graphics & Double Buffering for Touch Response Touch games must feel instant – input to visual feedback < 100ms. Enable double buffering: public class GameCanvas extends Canvas private Image offscreen; private Graphics offGfx; protected void sizeChanged(int w, int h) offscreen = Image.createImage(w, h); offGfx = offscreen.getGraphics();
GameCanvas() playerX = getWidth() / 2; playerY = getHeight() - 40; setFullScreenMode(true); java midp 2.0 touch screen games
public void startApp() canvas = new GameCanvas(); display = Display.getDisplay(this); display.setCurrent(canvas); canvas.start(); Use timestamps: record press time, check in update loop
Record touch down/up positions to detect direction. Use timestamps: record press time
