components
Class GameSpace

java.lang.Object
  extended by components.GameSpace
All Implemented Interfaces:
KeyListener, EventListener

public class GameSpace
extends Object
implements KeyListener

GameSpace is the game board where a game of Gizmoball take place

Specification Fields

Field Summary
protected  MagicKeyListener mkl
           
 
Constructor Summary
GameSpace(GameSettings settings)
           
 
Method Summary
 void add(GameObject o)
           
 void addDownKey(int key, GameObject tgt)
           
 void addUpKey(int key, GameObject tgt)
           
 Set<GameObject> getBalls()
          Returns just the balls
 GameObject getByName(String name)
           
 KeyListener getListener()
           
 GameObject getObjectByGrid(Vect3 p)
           
 Set<GameObject> getObjects()
           
 Set<GameObject> getObjectsBut(GameObjectClassification c)
           
 Set<GameObject> getObjectsNoWalls()
           
 KeyRegistry getRegistry()
          return the key registry
 GameSettings getSettings()
           
 Map<GameObjectClassification,String> getTexLocations()
           
 void keyPressed(KeyEvent arg0)
           
 void keyReleased(KeyEvent arg0)
           
 void keyTyped(KeyEvent arg0)
           
 void loadObject(GameObjectClassification objecttype, Map<String,String> properties)
           
 void loadSettings(GameSettings settings)
           
 void removeObject(GameObject go)
           
 void setTexLocations(Map<GameObjectClassification,String> newTL)
           
 void stepFrame()
           
 void writeXML(File name)
          Given a file name, will load that files gb xml data in this
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mkl

protected MagicKeyListener mkl
Constructor Detail

GameSpace

public GameSpace(GameSettings settings)
Method Detail

writeXML

public void writeXML(File name)
              throws ParserConfigurationException,
                     SAXException,
                     IOException
Given a file name, will load that files gb xml data in this

Throws:
IOException
SAXException
ParserConfigurationException
Requires:
string is a valid xml file location name

getByName

public GameObject getByName(String name)
Returns:
the gameobject whose name is the arugment "name"
Requires:
name is a the name of an object in this

getObjectsBut

public Set<GameObject> getObjectsBut(GameObjectClassification c)
Requires:
cname is the String name of a recognized class
Returns:
gObjects, without Walls or cnames

getObjects

public Set<GameObject> getObjects()
Returns:
gObjects U walls

getObjectsNoWalls

public Set<GameObject> getObjectsNoWalls()
Returns:
gObjects

getBalls

public Set<GameObject> getBalls()
Returns just the balls

Returns:
only the ball objects

add

public void add(GameObject o)
Requires:
o != null, o within bounds of the GameSpace, o.g equals this
Effects:
adds fo into the GameSpace

stepFrame

public void stepFrame()

getSettings

public GameSettings getSettings()
Returns:
this.settings

loadSettings

public void loadSettings(GameSettings settings)
Requires:
settings != null
Effects:
This loads settings into this, and replace this.settings

loadObject

public void loadObject(GameObjectClassification objecttype,
                       Map<String,String> properties)
Requires:
objecttype, properties != null, properties contains all the properties that objecttype requires
Effects:
creates a new GameObject according to properties and adds it into the GameSpace

getTexLocations

public Map<GameObjectClassification,String> getTexLocations()
Returns:
a Map of texture locations used by this GameObject keyed by GameObjectClassifications

getObjectByGrid

public GameObject getObjectByGrid(Vect3 p)
Returns:
the GameObject whose top left front corner is p or null if no such GameObject is in the GameSpace
Requires:
p != null, p is a top left front corner grid position

removeObject

public void removeObject(GameObject go)
Requires:
go != null
Effects:
removes go from gObjects if it is in gObjects
Modifies:
gObjects

setTexLocations

public void setTexLocations(Map<GameObjectClassification,String> newTL)
Requires:
newTL != null
Effects:
changes the set of textures used by this GameSpace to those specified by newTL
Modifies:
texLocations

getListener

public KeyListener getListener()

addUpKey

public void addUpKey(int key,
                     GameObject tgt)

addDownKey

public void addDownKey(int key,
                       GameObject tgt)

keyPressed

public void keyPressed(KeyEvent arg0)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent arg0)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent arg0)
Specified by:
keyTyped in interface KeyListener

getRegistry

public KeyRegistry getRegistry()
return the key registry