Java Reference
In-Depth Information
A corresponding MIDlet, QuatschMIDlet , is available in the code download but not presented
here. It creates and displays a QuatschCanvas and provides commands for showing and hiding
the layers.
Figure 14-7 shows QuatschMIDlet running in the emulator.
Figure 14-7. The whole iguana: sprites and tiled layers
Listing 14-2 contains the source code for QuatschCanvas .
Listing 14-2. QuatschCanvas, a Game API Example
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
public class QuatschCanvas
extends GameCanvas
implements Runnable {
private boolean mTrucking;
private LayerManager mLayerManager;
private TiledLayer mAtmosphere;
private TiledLayer mBackground;
private int mAnimatedIndex;
private Sprite mQuatsch;
private int mState, mDirection;
private static final int kStanding = 1;
private static final int kRunning = 2;
 
Search WWH ::




Custom Search