edu.fcps.karel2
Class Display

java.lang.Object
  extended by edu.fcps.karel2.Display

public class Display
extends java.lang.Object

Display houses most of the static constants used in object creation and rendering, Karel file locations and images, and the speed at which the WorldPanel updates. The Display.step() method is responsible for the animation of the Panel.


Field Summary
static java.lang.String DEFAULT_MAP
           
static int EAST
           
static int FRAME_HEIGHT
           
static int FRAME_WIDTH
           
static int HORIZONTAL
           
static int INFINITY
           
static int NORTH
           
static int SOUTH
           
static int VERTICAL
           
static int WEST
           
 
Constructor Summary
Display()
           
 
Method Summary
static int getSpeed()
          Returns the speed at which the Display updates.
static boolean isDead()
          Returns whether or not the Display is currently dead (no longer able to update).
static void openDefaultWorld()
          Closes the current world if there is one, then creates a new WorldFrame with the default map.
static void openWorld(java.lang.String mapName)
          Closes the current world if there is one, then creates a new WorldFrame with the specified map file.
static void pause()
          Sleeps the Thread for a period of time based on the current Display speed.
static void setSize(int x, int y)
          The same as calling WorldBackend.setSize(x, y)
static void setSpeed(int s)
          Sets the speed at which the Display updates.
static int validateDirection(int dir)
          Takes a possible invalid direction and returns a valid one via modding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAP

public static final java.lang.String DEFAULT_MAP
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

NORTH

public static final int NORTH
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

FRAME_WIDTH

public static int FRAME_WIDTH

FRAME_HEIGHT

public static int FRAME_HEIGHT

VERTICAL

public static final int VERTICAL
See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
See Also:
Constant Field Values

INFINITY

public static final int INFINITY
See Also:
Constant Field Values
Constructor Detail

Display

public Display()
Method Detail

openWorld

public static void openWorld(java.lang.String mapName)
Closes the current world if there is one, then creates a new WorldFrame with the specified map file.

Parameters:
mapName - the path to the map file to be loaded

openDefaultWorld

public static void openDefaultWorld()
Closes the current world if there is one, then creates a new WorldFrame with the default map.


setSpeed

public static void setSpeed(int s)
Sets the speed at which the Display updates.

Parameters:
s - the requested speed of the Display. If it is greater than the max speed, the speed is set to the max speed

getSpeed

public static int getSpeed()
Returns the speed at which the Display updates.


validateDirection

public static int validateDirection(int dir)
Takes a possible invalid direction and returns a valid one via modding

Parameters:
dir - a possibly invalid direction
Returns:
a valid direction

setSize

public static void setSize(int x,
                           int y)
The same as calling WorldBackend.setSize(x, y)

Parameters:
x -
y -

pause

public static void pause()
Sleeps the Thread for a period of time based on the current Display speed.


isDead

public static boolean isDead()
Returns whether or not the Display is currently dead (no longer able to update).