|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecterland.game.tetris.TetrisMain
public class TetrisMain
Field Summary | |
---|---|
protected int |
END_BLINK_SPEED
Speed of blinking text |
protected int |
endBlink
Counter to handle blinking of text when game is completed or GAME OVER has occurred |
protected int |
offsetX
Horizontal drawing offset |
protected int |
offsetY
Vertical drawing offset |
protected erland.game.tetris.BlockContainerData |
previewContainer
Container representing the next block |
protected int |
spaceBetweenSquares
Number of pixels between squares |
protected int |
squareSize
Size of the squares |
protected erland.game.tetris.BlockContainerData |
titleContainer
Container representing the game logo |
Constructor Summary | |
---|---|
TetrisMain(TetrisModelInterface model)
|
Method Summary | |
---|---|
void |
draw()
|
protected void |
drawContainer(Graphics g,
erland.game.tetris.BlockMatrix m,
int offsetX,
int offsetY,
int squareSize,
int spaceBetweenSquares,
int borderSize,
Color borderColor,
Color gridColor)
Draw all grapics in a specific BlockMatrix |
void |
exit()
|
protected void |
init()
Initialize a new game |
void |
init(GameEnvironmentInterface environment)
|
boolean |
isExit()
|
protected void |
makeTitle(erland.game.tetris.BlockMatrix m)
Draw the tetris logo in the specied BlockMatrix |
void |
newGame()
Start a new game, this will only succeed if there is not a game already running |
void |
setCheatmode(boolean enable)
|
void |
update()
|
protected void |
updatePreviewContainer()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected erland.game.tetris.BlockContainerData titleContainer
protected erland.game.tetris.BlockContainerData previewContainer
protected int squareSize
protected int offsetX
protected int offsetY
protected int spaceBetweenSquares
protected int endBlink
protected final int END_BLINK_SPEED
Constructor Detail |
---|
public TetrisMain(TetrisModelInterface model)
Method Detail |
---|
public boolean isExit()
isExit
in interface GamePanelInterface
public void setCheatmode(boolean enable)
setCheatmode
in interface GamePanelInterface
public void exit()
exit
in interface GamePanelInterface
public void init(GameEnvironmentInterface environment)
init
in interface GamePanelInterface
protected void init()
public void newGame()
protected void makeTitle(erland.game.tetris.BlockMatrix m)
m
- The BlockMatrix to draw the logo inpublic void update()
update
in interface GamePanelInterface
public void draw()
draw
in interface GamePanelInterface
protected void drawContainer(Graphics g, erland.game.tetris.BlockMatrix m, int offsetX, int offsetY, int squareSize, int spaceBetweenSquares, int borderSize, Color borderColor, Color gridColor)
g
- The Graphics object to draw onm
- The BlockMatix object to drawoffsetX
- The horisontal drawing offsetoffsetY
- The vertical drawing offsetsquareSize
- The size of each square in pixelsspaceBetweenSquares
- Number of pixels between each squareborderSize
- The size in pixels of the border around the drawn areaborderColor
- The color of the bordergridColor
- The color of the gridprotected void updatePreviewContainer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |