|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--nankin.zheng.gatem.view.RoleView
RoleView object saves all the image resources of a Role, and it is in charge of mapping a role's logical attributes to a certain appearance.
| Field Summary | |
protected AnchoredImage[] |
aImages
All the image resources that will be needed while drawing a role. |
private static int |
createdInstanceCount
|
protected DisplayCache |
displayCache
DisplayCache reference that accepts DrawCommand and helps drawing. |
protected Env |
env
Environment |
protected java.lang.String |
roleName
Role name. |
| Constructor Summary | |
RoleView(Env environ,
DisplayCache dc,
java.lang.String rname,
AnchoredImage[] aimgs)
Constructor, initialize image resources. |
|
| Method Summary | |
abstract void |
draw(AttributeSet attrSet)
Draw the role according to its logical attribute set. |
static int |
getCreatedInstanceCount()
|
java.lang.String |
getRoleName()
Get role name. |
void |
testInitialization()
Verify whether this object is initialized properly. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static int createdInstanceCount
protected java.lang.String roleName
protected Env env
protected AnchoredImage[] aImages
protected DisplayCache displayCache
| Constructor Detail |
public RoleView(Env environ,
DisplayCache dc,
java.lang.String rname,
AnchoredImage[] aimgs)
throws GameException
environ - environment.dc - DisplayCache, which will be used while drawing.rname - role name.aimgs - anchored image array.
java.lang.NullPointerException - if any of the parameters is null.
GameException - may be thrown out by its subclasses.| Method Detail |
public static int getCreatedInstanceCount()
public java.lang.String getRoleName()
public void testInitialization()
throws GameException
Before a game is started, all the role view objects should be initialized properly. This method verifies the initialization of the RoleView object. If it is not initialized properly, a GameException will be thrown out.
This method should be overwritten by its subclasses to provide more strict verification.
GameException - while is not initialized properly
public abstract void draw(AttributeSet attrSet)
throws GameException
It creates a DrawCommand object according to the role's
logical attribute set, and pass this command to DisplayCache
as following:
DrawCommand cmd = createDrawCommandFromAttrSet(attrSet);
displayCache.addToCache(cmd);
NOTE that all the DrawCommand objects are cached by DisplayCache object, and flushed to screen once every frame updating.
attrSet - role's logical attribute set.
GameException - may be thrown out by its subclasses.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||