|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunc.cdva.gameengine.GameEngine
public class GameEngine
Raw source events are passed to the game engine, which then in turn notifies listeners. The game engine will also as appropriate call the object managers to change the state of the model as needed by the specific event. The game engine is essentially the brain of the software, viewed in another way it is the controller of the mvc architecture implemented.
Field Summary | |
---|---|
protected java.util.Vector<GraphicsEventListener> |
graphicsEventlisteners
|
protected java.util.Vector<UIEventListener> |
uiEventlisteners
|
Constructor Summary | |
---|---|
GameEngine(javax.media.opengl.GLCanvas glCanvas)
Constructor - initializes the game engine. |
Method Summary | |
---|---|
void |
addGraphicsEventListener(GraphicsEventListener listener)
Registers a graphics event listener. |
void |
addProblem(GameEvent e,
Id problemId)
Invoked when a problem is added to the screen |
void |
addUIEventListener(UIEventListener listener)
Registers a ui event listener object. |
void |
cancelProblem(GameEvent e,
Id problemId)
Invoked when a problem is removed from the screen |
void |
fire(GameEvent e,
Id problemId)
Invoked when the gun fires! |
void |
freezeGame(GameEvent e)
Invoked when you stop the game |
protected ItemManager |
getItemsManager()
|
protected ProblemManager |
getProblemManager()
|
void |
loadLevel(int level)
Inits the game to a certain level. |
void |
loadMainMenu(GameEvent e)
Invoked when you load the main menu |
void |
loadNextLevel(GameEvent e)
Invoked when you load the next level after winning a level |
void |
loadOptionMenu(GameEvent e)
Invoked when you load the option menu |
void |
loadSinglePlayer(GameEvent e)
Invoked when you load a single player game |
void |
notifyAddGun(Id id)
Notifies the graphic listeners that a gun object has been added. |
void |
notifyAddProblem(Id problemId,
Object3D object)
Notifies the graphic listeners that a new problem object has been created. |
void |
notifyAddProjectile(Id id)
Notifes the graphic listeners that a projectile has been added. |
void |
notifyAddReticle(Id id)
Notifes the graphic listeners that a reticle has been added. |
void |
notifyAddTarget(Id id)
Notifes the graphic listeners that a target has been added. |
void |
notifyEndGame()
Notifes UI event listeners that the player has lost. |
void |
notifyEndLevel()
Notifies UI event listeners that the level is over, (the player has finished it). |
void |
notifyFreezeFireWindows()
Notifies UI event listeners that the fire windows have to been frozen |
void |
notifyInitLevel()
Notifes the graphic listeners that a new game level has been started. |
void |
notifyLoadBackground(java.lang.String background)
Notifies the ui listeners to load a new background. |
void |
notifyRemoveGun(Id id)
Notifies the graphic listeners that a gun has been removed. |
void |
notifyRemoveProblem(Id problemId)
Notifies graphic listeners that a problem has been removed. |
void |
notifyRemoveProjectile(Id id)
Notifes the graphic listeners that a projectile has been removed. |
void |
notifyRemoveReticle(Id id)
Notifes the graphic listeners that a reticle has been removed. |
void |
notifyRemoveTarget(Id id)
Notifes the graphic listeners that a target has been removed. |
void |
notifySetHighScoreLabel(long score)
Notifes the graphic listeners that the player's high score needs to be set. |
void |
notifySetLevelLabel(long level)
Notifes the graphic listeners that the level label needs to be updated. |
void |
notifySetScoreLabel(long score)
Notifes the graphic listeners that the player's score needs to be set. |
void |
notifyUnfreezeFireWindows()
Notifies UI event listeners that the fire windows no longer have to be frozen |
void |
notifyUpdateDisplayList()
Notifies the graphic event listeners that the display list has changed,and that there a new/updated things to draw. |
void |
notifyUpdateItemsBean(ItemsBean itemsBean)
Alerts the graphic event listeners that the items bean has changed. |
void |
quit(GameEvent e)
Invoked when the game quits |
void |
removeGraphicsEventListener(GraphicsEventListener listener)
Removes a graphics event listener. |
void |
removeUIEventListener(UIEventListener listener)
Removes a ui event listener. |
void |
setMasterVolume(GameEvent e,
float masterVolume)
Invoked when you set the master volume |
void |
setMusicFolder(GameEvent e,
java.lang.String musicFolder)
Invoked when you change the music folder |
void |
setProblemValue(GameEvent e,
Id problemId,
long value)
Invoked when the user set the value of a problem |
void |
setVideoResolution(GameEvent e,
java.awt.Dimension dimension)
Invoked when you change the screen resolution |
void |
unfreezeGame(GameEvent e)
Invoked when you resume the game |
void |
update(GameEvent e)
Invoked when the game engine is updated and the screen re-drawn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector<UIEventListener> uiEventlisteners
protected java.util.Vector<GraphicsEventListener> graphicsEventlisteners
Constructor Detail |
---|
public GameEngine(javax.media.opengl.GLCanvas glCanvas)
Method Detail |
---|
public void addProblem(GameEvent e, Id problemId)
GameEventListener
addProblem
in interface GameEventListener
problemId
- id of the new problemGameEventListener.addProblem(unc.cdva.events.gameevents.GameEvent,
Id)
public void cancelProblem(GameEvent e, Id problemId)
GameEventListener
cancelProblem
in interface GameEventListener
problemId
- is of the problem that has to be removedGameEventListener.cancelProblem(unc.cdva.events.gameevents.GameEvent,
Id)
public void fire(GameEvent e, Id problemId)
GameEventListener
fire
in interface GameEventListener
GameEventListener.fire(unc.cdva.events.gameevents.GameEvent,
Id)
public void freezeGame(GameEvent e)
GameEventListener
freezeGame
in interface GameEventListener
GameEventListener.freezeGame(unc.cdva.events.gameevents.GameEvent)
public void loadMainMenu(GameEvent e)
GameEventListener
loadMainMenu
in interface GameEventListener
GameEventListener.loadMainMenu(unc.cdva.events.gameevents.GameEvent)
public void loadNextLevel(GameEvent e)
GameEventListener
loadNextLevel
in interface GameEventListener
GameEventListener.loadNextLevel(unc.cdva.events.gameevents.GameEvent)
public void loadLevel(int level)
level
- The level to initialize the game to.public void loadOptionMenu(GameEvent e)
GameEventListener
loadOptionMenu
in interface GameEventListener
GameEventListener.loadOptionMenu(unc.cdva.events.gameevents.GameEvent)
public void loadSinglePlayer(GameEvent e)
GameEventListener
loadSinglePlayer
in interface GameEventListener
GameEventListener.loadSinglePlayer(unc.cdva.events.gameevents.GameEvent)
public void quit(GameEvent e)
GameEventListener
quit
in interface GameEventListener
GameEventListener.quit(unc.cdva.events.gameevents.GameEvent)
public void setMasterVolume(GameEvent e, float masterVolume)
GameEventListener
setMasterVolume
in interface GameEventListener
masterVolume
- new value of the volume (0. to 1.)GameEventListener.setMasterVolume(unc.cdva.events.gameevents.GameEvent,
float)
public void setMusicFolder(GameEvent e, java.lang.String musicFolder)
GameEventListener
setMusicFolder
in interface GameEventListener
musicFolder
- path of the new music folderGameEventListener.setMusicFolder(unc.cdva.events.gameevents.GameEvent,
java.lang.String)
public void setProblemValue(GameEvent e, Id problemId, long value)
GameEventListener
setProblemValue
in interface GameEventListener
problemId
- id of the problemvalue
- value entered by the userGameEventListener.setProblemValue(unc.cdva.events.gameevents.GameEvent,
Id, long)
public void setVideoResolution(GameEvent e, java.awt.Dimension dimension)
GameEventListener
setVideoResolution
in interface GameEventListener
dimension
- new size of the screenGameEventListener.setVideoResolution(unc.cdva.events.gameevents.GameEvent,
java.awt.Dimension)
public void unfreezeGame(GameEvent e)
GameEventListener
unfreezeGame
in interface GameEventListener
GameEventListener.unfreezeGame(unc.cdva.events.gameevents.GameEvent)
public void update(GameEvent e)
GameEventListener
update
in interface GameEventListener
GameEventListener.update(unc.cdva.events.gameevents.GameEvent)
public void addUIEventListener(UIEventListener listener)
listener
- The UIEventListener to notify.public void removeUIEventListener(UIEventListener listener)
listener
- The listener to remove.public void addGraphicsEventListener(GraphicsEventListener listener)
listener
- The listener to add.public void removeGraphicsEventListener(GraphicsEventListener listener)
listener
- The listener to remove.public void notifyUpdateDisplayList()
public void notifyUpdateItemsBean(ItemsBean itemsBean)
itemsBean
- The new item bean to notify the graphic
event listeners of.public void notifyLoadBackground(java.lang.String background)
background
- "main" to load the main menu background
"option" to load the option menu
backgroundpublic void notifyAddProblem(Id problemId, Object3D object)
problemId
- The id of the problem that has been
created.object
- The problem's object3d drawable object.public void notifyRemoveProblem(Id problemId)
problemId
- The id of the problem that has been
removed.public void notifyAddGun(Id id)
id
- the id of the added gun.public void notifyRemoveGun(Id id)
id
- The id of the removed gun.public void notifyAddTarget(Id id)
id
- The id of the added target.public void notifyRemoveTarget(Id id)
id
- The id of the removed target.public void notifyAddProjectile(Id id)
id
- The id of the added projectile.public void notifyRemoveProjectile(Id id)
id
- The id of the removed projectile.public void notifyAddReticle(Id id)
id
- The id of the added reticle.public void notifyRemoveReticle(Id id)
id
- The id of the removed reticle.public void notifyInitLevel()
public void notifySetScoreLabel(long score)
score
- The player's total score.public void notifySetHighScoreLabel(long score)
score
- The player's total high score.public void notifySetLevelLabel(long level)
level
- The level number the player is on.public void notifyEndGame()
public void notifyEndLevel()
public void notifyFreezeFireWindows()
public void notifyUnfreezeFireWindows()
protected ProblemManager getProblemManager()
protected ItemManager getItemsManager()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |