站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Wireless Java Developing with J2ME, Second Edition

Chapter 11: The Game API - Wireless Java Developing with J2ME, Second Edition

Previous Section Next Section

Chapter 11: The Game API

Many of the new features in MIDP 2.0 are aimed at making MIDP an attractive platform for games, which are the leading edge of consumer J2ME software. You've already read about some of the new goodies: RGB images and blitting in Canvas are two good examples. In the next chapter, you'll read about MIDP 2.0's support for multimedia. This chapter describes the new Game API, which simplifies writing 2D games.

Overview

The Game API builds on the Canvas and Graphics classes you read about in Chapter 10. The entire API is composed of five classes in the javax.microedition.lcdui.game package. One class, GameCanvas, provides methods for animation and key polling. The other four classes deal with layers, which can be used to compose scenes from several different elements.

GameCanvas offers two main advantages over Canvas. First, your application has control over exactly when the display is updated, instead of having to wait for the system software to call paint(). Second, you can control what region of the screen is updated. GameCanvas gives your application very specific control of display updates.


Previous Section Next Section