|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunc.cdva.renderingengine.GraphicsManager
public class GraphicsManager
Object that manage the graphics elements of the game. Basically it keeps a copy of every kind of 3D objects that will need during the game. Then when a new object has to be displayed, it clones that first copy of the object to speed up the process and decrease the memory usage All the objects are loaded by parsing an xml files that contains all their properties. This manager is implemented as a singleton.
Field Summary | |
---|---|
static GraphicsManager |
singleton
Singleton |
Method Summary | |
---|---|
void |
addGun(GraphicsEvent event,
Id itemId)
Invoked when a new gun is added |
void |
addProblem(GraphicsEvent event,
Id problemId,
Object3D object)
Invoked when a new problem is added |
void |
addProjectile(GraphicsEvent event,
Id itemId)
Invoked when a projectile is added |
void |
addReticle(GraphicsEvent event,
Id problemId)
Invoked when a new reticle is added |
void |
addTarget(GraphicsEvent event,
Id itemId)
Invoked when a target is added |
DisplayList |
getDisplayList()
|
AnimatedObject |
getGun(Id id)
Get a gun object from the gun list according to its id |
static GraphicsManager |
getInstance(boolean useShader,
javax.media.opengl.GL gl)
Initialize the graphic manager if needed, and return the only instance allowed to be instanciated |
ItemsBean |
getItemsBean()
|
Object3D |
getProblem(Id problemId)
Get a problem object from the problem list according to its id |
AnimatedObject |
getProjectile(Id itemId)
Get a projectile object from the projectile list according to its id |
TextureAnimatedObject |
getReticle(Id problemId)
Get a reticle object from the reticle list according to a problem id |
TextureAnimatedObject |
getReticleInstance()
|
AnimatedObject |
getTarget(Id id)
Get a target object from the target list according to its id |
void |
initLevel(GraphicsEvent event)
Invoked when a level is started |
void |
initObjects()
Load the prototype of all the objects in memory |
void |
loadBackground(GraphicsEvent event,
java.lang.String type)
Invoked when the background has to be change |
void |
removeGun(GraphicsEvent event,
Id itemId)
Invoked when a gun is removed |
void |
removeProblem(GraphicsEvent event,
Id problemId)
Invoked when a problem is removed |
void |
removeProjectile(GraphicsEvent event,
Id itemId)
Invoked when a projectile is removed |
void |
removeReticle(GraphicsEvent event,
Id problemId)
Invoked when a reticle if removed |
void |
removeTarget(GraphicsEvent event,
Id id)
Invoked when a target is removed |
void |
setDisplayList(DisplayList displayList)
|
void |
setItemsBean(GraphicsEvent event,
ItemsBean itemsBean)
Invoked when the itemsBean of the listener has to be reset. |
void |
updateDisplayList(GraphicsEvent event)
Invoked when the display list has to be updated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static GraphicsManager singleton
Method Detail |
---|
public static GraphicsManager getInstance(boolean useShader, javax.media.opengl.GL gl)
useShader
- are we using the toon shading program?gl
- OpengGL context
public void initObjects()
public void initLevel(GraphicsEvent event)
GraphicsEventListener
initLevel
in interface GraphicsEventListener
GraphicsEventListener.initLevel(GraphicsEvent)
public void updateDisplayList(GraphicsEvent event)
GraphicsEventListener
updateDisplayList
in interface GraphicsEventListener
GraphicsEventListener.updateDisplayList(GraphicsEvent)
public void loadBackground(GraphicsEvent event, java.lang.String type)
GraphicsEventListener
loadBackground
in interface GraphicsEventListener
type
- "main" to load the main background,
"option" to load the option backgroundGraphicsEventListener.loadBackground(GraphicsEvent,
String)
public void addProblem(GraphicsEvent event, Id problemId, Object3D object)
GraphicsEventListener
addProblem
in interface GraphicsEventListener
problemId
- id of the problemobject
- drawable object representing the problemGraphicsEventListener.addProblem(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id,
unc.cdva.graphics.models.Object3D)
public Object3D getProblem(Id problemId)
problemId
- id of the problem
public void removeProblem(GraphicsEvent event, Id problemId)
GraphicsEventListener
removeProblem
in interface GraphicsEventListener
problemId
- id of the problemGraphicsEventListener.removeProblem(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public void addTarget(GraphicsEvent event, Id itemId)
GraphicsEventListener
addTarget
in interface GraphicsEventListener
itemId
- id of the targetGraphicsEventListener.addTarget(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public AnimatedObject getTarget(Id id)
id
- id of the target
public void removeTarget(GraphicsEvent event, Id id)
GraphicsEventListener
removeTarget
in interface GraphicsEventListener
id
- id of the target that has to be removedGraphicsEventListener.removeTarget(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public void addGun(GraphicsEvent event, Id itemId)
GraphicsEventListener
addGun
in interface GraphicsEventListener
itemId
- id of the new gunGraphicsEventListener.addGun(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public AnimatedObject getGun(Id id)
id
- id of the gun
public void removeGun(GraphicsEvent event, Id itemId)
GraphicsEventListener
removeGun
in interface GraphicsEventListener
itemId
- id of the gunGraphicsEventListener.removeGun(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public void addProjectile(GraphicsEvent event, Id itemId)
GraphicsEventListener
addProjectile
in interface GraphicsEventListener
itemId
- id of the projectileGraphicsEventListener.addProjectile(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public AnimatedObject getProjectile(Id itemId)
itemId
- id of the projectile
public void removeProjectile(GraphicsEvent event, Id itemId)
GraphicsEventListener
removeProjectile
in interface GraphicsEventListener
itemId
- id of the projectile that has to be
removedGraphicsEventListener.removeProjectile(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public void addReticle(GraphicsEvent event, Id problemId)
GraphicsEventListener
addReticle
in interface GraphicsEventListener
problemId
- id of the new reticleGraphicsEventListener.addReticle(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public TextureAnimatedObject getReticle(Id problemId)
problemId
- id of the problem
public void removeReticle(GraphicsEvent event, Id problemId)
GraphicsEventListener
removeReticle
in interface GraphicsEventListener
problemId
- id of the reticleGraphicsEventListener.removeReticle(unc.cdva.events.graphicsevents.GraphicsEvent,
unc.cdva.utils.Id)
public TextureAnimatedObject getReticleInstance()
public DisplayList getDisplayList()
public ItemsBean getItemsBean()
public void setDisplayList(DisplayList displayList)
displayList
- the displayList to setpublic void setItemsBean(GraphicsEvent event, ItemsBean itemsBean)
GraphicsEventListener
setItemsBean
in interface GraphicsEventListener
itemsBean
- the itemsBean to setGraphicsEvent
,
ItemsBean
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |