|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nankin.zheng.gatem.util.Env
This class defines the basic constants for the game environment.
All the environment variables listed here are common variables that are necessary for almost all the games.
Some of them can be defined directly here as constants, so they appear to be public and final.
The others should be specified differently according to different games, so they appear to be protected and not final. They can be visited by getXXX() methods, but should not be modified after initialization. A certain game should extend this class, implement the init() method to specify these game-dependent variables.
NOTE that all the protected fields must be initialized properly by its subclass. They should never change throughout the game.
Field Summary | |
private int |
BACKGROUND_HEIGHT
Background height (logical coordonate) |
private int |
BACKGROUND_WIDTH
Background width (logical coordonate) |
static int |
DOWN
|
static int |
DOWN_LEFT
|
static int |
DOWN_RIGHT
|
protected static java.lang.Class |
FILE_LOCATOR
File locator, a Class object to locate game resources. |
static int |
LEFT
|
protected static int |
MS_PER_FRAME
Frame updating speed. |
protected static int |
MS_PER_FRAME_MIN
Frame updating speed limit. |
static int |
RIGHT
|
protected int |
STEP_X
Mapping from logical coordonate to physical coordonate. |
protected int |
STEP_Y
Mapping from logical coordonate to physical coordonate. |
static int |
STILL
|
static int |
UP
|
static int |
UP_LEFT
|
static int |
UP_RIGHT
|
protected int |
VIEWPORT_HEIGHT
Viewport height (logical coordonate) |
protected int |
VIEWPORT_MARGIN
Viewport margin (logical coordonate). |
protected int |
VIEWPORT_START_X
Viewport start x (physical coordonate) |
protected int |
VIEWPORT_START_Y
Viewport start y (physical coordonate) |
protected int |
VIEWPORT_WIDTH
Viewport width (logical coordonate) |
protected static int |
WINDOW_HEIGHT
Window height (physical coordonate) |
protected static int |
WINDOW_WIDTH
Window width (physical coordonate) |
Constructor Summary | |
Env()
Constructor. |
Method Summary | |
int |
getBackgroundHeight()
Get BACKGROUND_HEIGHT. |
int |
getBackgroundWidth()
Get BACKGROUND_WIDTH. |
static java.lang.Class |
getFileLocator()
Get file locator. |
static int |
getMsPerFrame()
Get MS_PER_FRAME. |
static int |
getMsPerFrameMin()
Get MS_PER_FRAME_MIN. |
int |
getStepX()
Get STEP_X. |
int |
getStepY()
Get STEP_Y. |
int |
getViewportHeight()
Get VIEWPORT_HEIGHT. |
int |
getViewportMargin()
Get VIEWPORT_MARGIN. |
int |
getViewportStartX()
Get VIEWPORT_START_X. |
int |
getViewportStartY()
Get VIEWPORT_START_Y. |
int |
getViewportWidth()
Get VIEWPORT_WIDTH. |
static int |
getWindowHeight()
Get WINDOW_HEIGHT. |
static int |
getWindowWidth()
Get WINDOW_WIDTH. |
protected abstract void |
init()
Initialize all game-dependent environment variables. |
void |
setBackgroundHeight(int bgheight)
Set BACKGROUND_HEIGHT. |
void |
setBackgroundWidth(int bgwidth)
Set BACKGROUND_WIDTH. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STILL
public static final int UP
public static final int DOWN
public static final int LEFT
public static final int RIGHT
public static final int UP_LEFT
public static final int DOWN_RIGHT
public static final int UP_RIGHT
public static final int DOWN_LEFT
protected static int MS_PER_FRAME
protected static int MS_PER_FRAME_MIN
protected int STEP_X
protected int STEP_Y
protected static int WINDOW_WIDTH
protected static int WINDOW_HEIGHT
protected int VIEWPORT_START_X
protected int VIEWPORT_START_Y
private int BACKGROUND_WIDTH
private int BACKGROUND_HEIGHT
protected int VIEWPORT_WIDTH
protected int VIEWPORT_HEIGHT
protected int VIEWPORT_MARGIN
protected static java.lang.Class FILE_LOCATOR
Constructor Detail |
public Env()
Method Detail |
public static int getMsPerFrame()
public static int getMsPerFrameMin()
public int getStepX()
public int getStepY()
public static int getWindowWidth()
public static int getWindowHeight()
public int getViewportStartX()
public int getViewportStartY()
public void setBackgroundWidth(int bgwidth)
bgwidth
- BACKGROUND_WIDTHpublic int getBackgroundWidth()
public void setBackgroundHeight(int bgheight)
public int getBackgroundHeight()
public int getViewportWidth()
public int getViewportHeight()
public int getViewportMargin()
public static java.lang.Class getFileLocator()
protected abstract void init()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |