group1.view
Class View

java.lang.Object
  extended by group1.view.View
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class View
extends java.lang.Object
implements java.awt.event.ActionListener


Constructor Summary
View()
          Default constructor acceptingGameEvent is set to false
View(Game g, java.awt.event.KeyListener k)
          Constructor with a game parameter.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is called by the timer.
 void beginTimeClicks()
          This method creates the timer, and starts it.
 javax.swing.JFrame getMyFrame()
          THIS IS ONLY HERE FOR TESTING PURPOSES
 GamePanel getMyGamePanel()
          THIS IS ONLY HERE FOR TESTING PURPOSES
 void handleBuyMenuEvent(BuyMenuEvent e)
          The buyMenuEvent handler.
 void handleContinueMenuEvent(ContinueMenuEvent e)
          The continueMenuEvent handler.
 void handleEndOfLevelEvent(EndOfLevelEvent e)
          The endOfLevelEvent handler.
 void handleInGameEvent(InGameEvent e)
          The inGameEvent handler.
 void handleInstructionsEvent(InstructionsEvent e)
          The intructionsEvent handler.
 void handleJeffDiesEvent(JeffDiesEvent e)
          The jeffDiesEvent handler.
 void handleLoadEvent(LoadEvent e)
          The loadEvent handler.
 void handleMainMenuEvent(MainMenuEvent e)
          The mainMenuEvent handler.
 void handleNewGameEvent(NewGameEvent e)
          The newGameEvent handler.
 void handlePauseMenuEvent(PauseMenuEvent e)
          The pauseMenuEvent handler.
 void handleSaveEvent(SaveEvent e)
          The saveEvent handler.
 void handleStartOfLevelEvent(StartOfLevelEvent e)
          The startOfMenuEvent handler.
 void handleWeaponSwitchMenuEvent(WeaponSwitchMenuEvent e)
          The weaponSwitchMenuEvent handler.
 void initializeGUI()
          This method is called during the initialization of the game.
static void main(java.lang.String[] argc)
          For testing purposed only
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

View

public View()
Default constructor acceptingGameEvent is set to false


View

public View(Game g,
            java.awt.event.KeyListener k)
Constructor with a game parameter. Assigns the game, initializes the GUI and more set-up acceptingGameEvent is set to false

Parameters:
g - The game that the view will handle events from
Method Detail

initializeGUI

public void initializeGUI()
This method is called during the initialization of the game. Called only once from the constructor. Creates the frame, gamePanel, etc. and makes them visible.


beginTimeClicks

public void beginTimeClicks()
This method creates the timer, and starts it. Called from the constructor


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This method is called by the timer. Simply makes acceptingGameEvents true. With this boolean true, the handleInGameEvent method will process the event rather than ignore it.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

handleMainMenuEvent

public void handleMainMenuEvent(MainMenuEvent e)
The mainMenuEvent handler.

Parameters:
e - contains all the info needed about the mainMenuEvent.

handlePauseMenuEvent

public void handlePauseMenuEvent(PauseMenuEvent e)
The pauseMenuEvent handler.

Parameters:
e - contains all the info needed about the pauseMenuEvent

handleBuyMenuEvent

public void handleBuyMenuEvent(BuyMenuEvent e)
The buyMenuEvent handler.

Parameters:
e - contains all the info needed about the buyMenuEvent

handleContinueMenuEvent

public void handleContinueMenuEvent(ContinueMenuEvent e)
The continueMenuEvent handler.

Parameters:
e - contains all the info needed about the continueMenuEvent

handleWeaponSwitchMenuEvent

public void handleWeaponSwitchMenuEvent(WeaponSwitchMenuEvent e)
The weaponSwitchMenuEvent handler.

Parameters:
e - contains all the info needed about the weaponSwitchMenuEvent

handleNewGameEvent

public void handleNewGameEvent(NewGameEvent e)
The newGameEvent handler.

Parameters:
e - contains all the info needed about the newGameEvent

handleSaveEvent

public void handleSaveEvent(SaveEvent e)
The saveEvent handler.

Parameters:
e - contains all the info needed about the saveEvent

handleLoadEvent

public void handleLoadEvent(LoadEvent e)
The loadEvent handler.

Parameters:
e - contains all the info needed about the loadEvent

handleInstructionsEvent

public void handleInstructionsEvent(InstructionsEvent e)
The intructionsEvent handler.

Parameters:
e - contains all the info needed about the instructionsEvent

handleStartOfLevelEvent

public void handleStartOfLevelEvent(StartOfLevelEvent e)
The startOfMenuEvent handler.

Parameters:
e - contains all the info needed about the startOfMenuEvent

handleEndOfLevelEvent

public void handleEndOfLevelEvent(EndOfLevelEvent e)
The endOfLevelEvent handler.

Parameters:
e - contains all the info needed about the endOfLevelEvent

handleJeffDiesEvent

public void handleJeffDiesEvent(JeffDiesEvent e)
The jeffDiesEvent handler.

Parameters:
e - contains all the info needed about the jeffDiesEvent

handleInGameEvent

public void handleInGameEvent(InGameEvent e)
The inGameEvent handler. The event is only processed if the boolean 'acceptingGameEvents' is set to true. This way the view can control the rate at which it processes events independently of the rate at which the model spits them out. Updates/scrolls the background. Updates the gameObj set. Updates the score and HP.

Parameters:
e - contains all the info needed about the inGameEvent

getMyGamePanel

public GamePanel getMyGamePanel()
THIS IS ONLY HERE FOR TESTING PURPOSES

Returns:

getMyFrame

public javax.swing.JFrame getMyFrame()
THIS IS ONLY HERE FOR TESTING PURPOSES

Returns:

main

public static void main(java.lang.String[] argc)
For testing purposed only

Parameters:
argc -