Game API

The Game API package, which in itself is an extension of LCDUI and thus the MIDP 2.0 API, provides a series of classes that enable the development of rich gaming content for wireless devices.

Mobile devices have minimal processing power, so much of the API is intended to improve performance by minimizing the amount of work done in Java™; this approach also has the added benefit of reducing application size. The APIs are structured to provide considerable freedom when implementing them, thereby permitting the extensive use of native code, hardware acceleration and device-specific image data formats as needed. The API uses the standard low-level graphics classes from MIDP (Graphics, Image, and so on) so that the high-level Game API classes can be used in conjunction with graphics primitives. For example, it would be possible to render a complex background using the Game API and then render something on top of it using graphics primitives such as drawLine.

The Game API has its own package: javax.microedition.lcdui.game. It is included as part of the MIDP 2.0 API specification. The API was first introduced in S60 2nd Edition and Series 40 2nd Edition.

This guide features the use of the following MIDP 2.0 Game API features:

  • Class GameCanvas, a subclass of Canvas with game-related features

  • Class Sprite, for animated sprites

  • Class TiledLayer, for tiled game backgrounds, including animated tiles

  • Class LayerManager, for managing Sprites and TiledLayers

The following MIDP 2.0 features will also be covered, as they are useful for games:

  • MIDP 2.0 Media API, for playing sound effects

  • Features of the MIDP 2.0 low-level UI, including transparent images, full-screen mode, vibration, and backlight flashing

For more information about the Game API, see: