FileDocCategorySizeDatePackage
GameMap.javaAPI DocphoneME MR2 API (J2ME)4406Wed May 02 18:00:24 BST 2007com.sun.midp.lcdui

GameMap

public class GameMap extends Object
A class that maps between DisplayAccess objects and Displayable, GameCanvas. In future versions of the MIDP spec, GameCanvas may have been moved to lcdui package, in which case this class isn't needed.

Fields Summary
private static javax.microedition.lcdui.Displayable
displayable
The Displayable associated with the DisplayAccess
private static DisplayAccess
displayAccess
The DisplayAccess associated with the GameCanvas
private static GraphicsAccess
graphicsAccess
The GraphicsAccess tunnel instance handed out from javax.microedition.lcdui package
private static GameAccess
gameAccess
The GameAccess tunnel instance handed out from javax.microedition.lcdui.game package
private static final Object
lock
Lock to ensure synchronized access to the displayable
Constructors Summary
Methods Summary
public static DisplayAccessgetDisplayAccess(javax.microedition.lcdui.Displayable c)
Gets the DisplayAccess object for this Displayable.

param
c The Displayable to get the DisplayAccess for
return
DisplayAccess The DisplayAccess associated with the MIDlet

        synchronized (lock) {
  	        if (c == displayable) {
                return displayAccess;
  	        } else {
                return null;
	        }
        }
    
public static GameCanvasLFImplgetGameCanvasImpl(javax.microedition.lcdui.game.GameCanvas c)
Gets the GameCanvasLFImpl object for this GameCanvas.

param
c The GameCanvas to get the GameCanvasLFImpl for
return
GameCanvasLFImpl, or null if there is no accessor to game package

        if (gameAccess != null) {
            return gameAccess.getGameCanvasLFImpl(c);
        }
        return null;
    
public static GraphicsAccessgetGraphicsAccess()
Gets GraphicsAccess instance needed to access extended Image and Graphics APIs

return
GraphicsAccess tunnel instance

        synchronized (lock) {
            return graphicsAccess;
        }
    
public static voidregisterDisplayAccess(javax.microedition.lcdui.Displayable c, DisplayAccess d)
Associates the given Displayable and DisplayAccess. This is a one-way association.

param
c The GameCanvas to store
param
d The DisplayAccess associated with the GameCanvas


                                   
           
        synchronized (lock) {
	        displayable = c;
	        displayAccess = d;
	    }
    
public static voidregisterGameAccess(GameAccess gameAccess)
Register given game package accessor instance

param
gameAccess implementation of the GameAccess interface

        synchronized (lock) {
            GameMap.gameAccess = gameAccess;
        }
    
public static voidregisterGraphicsAccess(GraphicsAccess graphicsAccess)
Sets graphics accessor instance from javax.microedition.lcdui package to use extended package-private Image and Graphics APIs

param
graphicsAccess graphics accessor tunnel

        synchronized (lock) {
            GameMap.graphicsAccess = graphicsAccess;
        }