|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eviline.Field
public class Field
Object which keeps track of the tetris matrix itself. It keeps an array of Block
enums
to store the state of the matrix, using null
to store an empty area.
This is the "engine" of tetrevil.
Field Summary | |
---|---|
protected ShapeDirection |
autoShift
The direction of the currently active DAS |
static int |
BUFFER
The size of the buffer area around the matrix in each direction |
protected EventDispatcher |
dispatcher
|
protected Block[][] |
field
The matrix itself |
protected boolean |
gameOver
Whether a game is over |
protected int |
garbage
|
protected boolean |
ghosting
Whether ghosting is enabled |
protected int |
ghostY
The vertical position of the current shape's ghost |
static int |
HEIGHT
The height of the matrix |
protected int |
lines
The number of lines scored so far |
protected EvilineListener[] |
listeners
Event listeners |
protected BlockMetadata[][] |
metadata
|
protected boolean |
multiplayer
|
protected boolean |
paused
Whether a game is paused |
protected boolean |
playing
Whether a game is playing |
protected Randomizer |
provider
The source of shapes |
protected double |
score
|
protected double |
scoreFactor
|
protected Shape |
shape
The current shape |
protected int |
shapeId
|
protected int |
shapeX
The horizontal position of the current shape |
protected int |
shapeY
The vertical position of the current shape |
protected boolean |
unpausable
|
static int |
WIDTH
The width of the matrix |
protected boolean |
winner
|
Constructor Summary | |
---|---|
Field()
|
Method Summary | |
---|---|
void |
addEvilineListener(EvilineListener l)
Add a tetrevil listener to this field |
protected void |
applyGarbage()
|
void |
autoshift()
Auto-shift the current shape all the way to the left or right. |
void |
clockTick()
Cause one clock tick. |
Field |
copy()
|
Field |
copyInto(Field target)
Copy this Field into a target and return the target. |
protected void |
fireClockTicked()
|
protected void |
fireGameOver()
|
protected void |
fireGamePaused()
|
protected void |
fireGameReset()
|
protected void |
fireGarbageReceived(int lines)
|
protected void |
fireHardDropped()
|
protected void |
fireLinesCleared(int lines)
|
protected void |
fireRotatedLeft()
|
protected void |
fireRotatedRight()
|
protected void |
fireShapeLocked()
|
protected void |
fireShapeSpawned()
|
protected void |
fireShiftedLeft()
|
protected void |
fireShiftedRight()
|
void |
garbage(int lines)
|
ShapeDirection |
getAutoShift()
|
Block |
getBlock(int x,
int y)
Return the block at the specified x,y pair, with the current shape and current ghost applied. |
Block[][] |
getField()
|
Block |
getFieldBlock(int x,
int y)
|
int |
getGhostY()
|
int |
getLines()
|
BlockMetadata |
getMetadata(int x,
int y)
|
Randomizer |
getProvider()
|
double |
getScore()
|
double |
getScoreFactor()
|
Shape |
getShape()
|
int |
getShapeX()
|
int |
getShapeY()
|
void |
hardDrop()
|
boolean |
isGameOver()
|
boolean |
isGhosting()
|
boolean |
isGrounded()
Returns whether the current shape is "grounded", e.g. |
boolean |
isMultiplayer()
|
boolean |
isPaused()
|
boolean |
isPlaying()
|
boolean |
isUnpausable()
|
boolean |
isWinner()
|
Field |
newInstance()
|
void |
reghost()
Recalculate the ghost location |
void |
removeEvilineListener(EvilineListener l)
Remove a tetrevil listener from this field |
void |
reset()
Reset the field |
void |
reverseRotateLeft()
|
void |
reverseRotateRight()
|
void |
rotateLeft()
Counter-clockwise shape rotation |
void |
rotateRight()
Clockwise shape rotation |
void |
setAutoShift(ShapeDirection autoShift)
|
void |
setField(Block[][] field)
|
void |
setGameOver(boolean gameOver)
|
void |
setGhosting(boolean ghosting)
|
void |
setLines(int lines)
|
void |
setMultiplayer(boolean multiplayer)
|
void |
setPaused(boolean paused)
|
void |
setProvider(Randomizer provider)
|
void |
setScore(double score)
|
void |
setScoreFactor(double scoreFactor)
|
void |
setShape(Shape shape)
|
void |
setShapeX(int shapeX)
|
void |
setShapeY(int shapeY)
|
void |
setUnpausable(boolean unpausable)
|
void |
setWinner(boolean winner)
|
void |
shiftDown()
|
void |
shiftLeft()
Shift the current shape one to the left |
void |
shiftRight()
Shift the current shape one to the right |
void |
softDrop()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int HEIGHT
public static final int WIDTH
public static final int BUFFER
protected Block[][] field
protected transient BlockMetadata[][] metadata
protected Randomizer provider
protected Shape shape
protected int shapeX
protected int shapeY
protected boolean ghosting
protected int ghostY
protected boolean playing
protected boolean gameOver
protected boolean paused
protected int garbage
protected int lines
protected double score
protected double scoreFactor
protected ShapeDirection autoShift
protected boolean unpausable
protected transient boolean winner
protected transient boolean multiplayer
protected transient int shapeId
protected transient EvilineListener[] listeners
protected transient EventDispatcher dispatcher
Constructor Detail |
---|
public Field()
Method Detail |
---|
public Field newInstance()
public Field copyInto(Field target)
Field
into a target and return the target.
target
- The destination and return Field
public Field copy()
public void reset()
public void clockTick()
public boolean isGrounded()
public void shiftLeft()
public void shiftRight()
public void shiftDown()
public void softDrop()
public void hardDrop()
public void autoshift()
public void reghost()
public void rotateLeft()
public void reverseRotateLeft()
public void rotateRight()
public void reverseRotateRight()
public void garbage(int lines)
protected void applyGarbage()
public Block getBlock(int x, int y)
TetrevilTableModel
x
- y
-
public Block getFieldBlock(int x, int y)
public BlockMetadata getMetadata(int x, int y)
public void addEvilineListener(EvilineListener l)
l
- public void removeEvilineListener(EvilineListener l)
l
- protected void fireClockTicked()
protected void fireGameOver()
protected void fireGamePaused()
protected void fireGameReset()
protected void fireShiftedLeft()
protected void fireShiftedRight()
protected void fireRotatedLeft()
protected void fireRotatedRight()
protected void fireLinesCleared(int lines)
protected void fireGarbageReceived(int lines)
protected void fireShapeSpawned()
protected void fireShapeLocked()
protected void fireHardDropped()
public Randomizer getProvider()
public void setProvider(Randomizer provider)
public Shape getShape()
public int getShapeX()
public int getShapeY()
public int getGhostY()
public boolean isGameOver()
public void setShape(Shape shape)
public void setShapeX(int shapeX)
public void setShapeY(int shapeY)
public void setGameOver(boolean gameOver)
public int getLines()
public void setLines(int lines)
public boolean isPaused()
public void setPaused(boolean paused)
public ShapeDirection getAutoShift()
public void setAutoShift(ShapeDirection autoShift)
public Block[][] getField()
public void setField(Block[][] field)
public boolean isGhosting()
public void setGhosting(boolean ghosting)
public boolean isUnpausable()
public void setUnpausable(boolean unpausable)
public boolean isPlaying()
public boolean isWinner()
public void setWinner(boolean winner)
public boolean isMultiplayer()
public void setMultiplayer(boolean multiplayer)
public String toString()
toString
in class Object
public double getScore()
public void setScore(double score)
public double getScoreFactor()
public void setScoreFactor(double scoreFactor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |