Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Game API

From Wiki
Jump to: navigation, search
See Also

Game API (Java Developer's Library)
Article Metadata
Series 40
Created: User:Axs (11 Sep 2007)
Last edited: hamishwillee (31 Jul 2013)



The Game API is a set of Java classes which enable easier development of rich gaming content on MIDP 2.0 enabled mobile devices. The Game API classes are stored in the package and included into the standard MIDP 2.0.

The Game API classes are: GameCanvas, Layer, LayerManager, Sprite and TiledLayer.


GameCanvas is an extension of the standard Canvas class from the LCDUI. The main features of the GameCanvas are controlled graphics flushing and ability to query states of the game keys. Quite many mobile platforms are supporting GameCanvas with double-buffering for the graphical content to provide smooth image animations on the mobile display.


Layer is an abstract class representing a visual element of a game. Each Layer has its position (in terms of the upper-left corner of its visual bounds), width, height, and can be made visible or invisible.


The LayerManager manages a series of Layers. The LayerManager simplifies the process of rendering the Layers that have been added to it by automatically rendering the correct regions of each Layer in the appropriate order.


Sprite is a basic visual element that can be rendered with one of several frames stored in an Image; different frames can be shown to animate the Sprite. Several transforms such as flipping and rotation can also be applied to a Sprite to further vary its appearance. As with all Layer subclasses, a Sprite's location can be changed and it can also be made visible or invisible.


A TiledLayer is a visual element composed of a grid of cells that can be filled with a set of tile images. This class allows large virtual layers to be created without the need for an extremely large Image. This technique is commonly used in 2D gaming platforms to create very large scrolling backgrounds or game fields.


Internal Links

This page was last modified on 31 July 2013, at 03:53.
63 page views in the last 30 days.