O'Reilly logo

Java™ ME Game Programming, Second Edition by Ph.D. Martin J. Wells, Ph.D. John P. Flynt

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

GSCanvas

The GSCanvas class provides a large variety of event-processing capabilities, in addition to other features, such as a Thread object and double buffering of images. To use the GSCanvas class, you require an entrance point; this is provided by the GameStart class, which has been discussed already. The code for the GSCanvas class is located in the Chapter 13 source folder, in the NetBeans Chapter13MIDlets project. It is also available in the standalone folder. Here is the code for the class.

/* * Chapter 13 \ GSCanvas.java * */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.util.*; // #1 public class GSCanvas extends Canvas implements Runnable, CommandListener{ // #1.1 private Random random; private ...

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