O'Reilly logo

Kicking Butt with MIDP and MSA: Creating Great Mobile Applications by Jonathan Knudsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11. Using the Game API

ONE popular category of Java ME applications is games. Even when faster data networks make other types of applications more popular, games will always be an important part of the Java ME ecosystem.

MIDP has a Game API designed to help you create 2D action or board games. It has a souped-up canvas and supports building a screen using multiple layers. The entire API consists of five classes in the javax.microedition.lcdui.game package.

11.1. Tight Looping with GameCanvas

Suppose you write a typical game using Canvas. You do your own drawing in paint() and respond to key events in the event callback methods. You have a separate thread that updates the game’s state and requests screen updates using repaint(). It looks something ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required