Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

GenericTetrix Class Reference

#include </home/clem/local/src/opie/noncore/games/tetrix/gtetrix.h>

Inheritance diagram for GenericTetrix:

Inheritance graph
[legend]
Collaboration diagram for GenericTetrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GenericTetrix (int boardWidth=10, int boardHeight=22)
virtual ~GenericTetrix ()
void clearBoard (int fillRandomLines=0)
void revealNextPiece (int revealIt)
void updateBoard (int x1, int y1, int x2, int y2, int dontUpdateBlanks=0)
void updateNext ()
void hideBoard ()
void showBoard ()
void fillRandom (int line)
void moveLeft (int steps=1)
void moveRight (int steps=1)
void rotateLeft ()
void rotateRight ()
void dropDown ()
void oneLineDown ()
void newPiece ()
void removePiece ()
int noOfClearLines ()
int getLinesRemoved ()
int getPiecesDropped ()
int getScore ()
int getLevel ()
int boardHeight ()
int boardWidth ()
virtual void drawSquare (int x, int y, int value)=0
virtual void gameOver ()=0
virtual void startGame (int gameType=0, int fillRandomLines=0)
virtual void drawNextSquare (int x, int y, int value)
virtual void pieceDropped (int dropHeight)
virtual void updateRemoved (int noOfLines)
virtual void updateScore (int newScore)
virtual void updateLevel (int newLevel)

Private Member Functions

void draw (int x, int y, int value)
void removeFullLines ()
void removeLine (int line)
void showPiece ()
void erasePiece ()
void internalPieceDropped (int dropHeight)
void gluePiece ()
void showNextPiece (int erase=0)
void eraseNextPiece ()
int canPosition (TetrixPiece &piece)
int canMoveTo (int xPosition, int line)
void moveTo (int xPosition, int line)
void position (TetrixPiece &piece)
void optimizedMove (int newPos, int newLine, TetrixPiece &newPiece)
int & board (int x, int y)

Private Attributes

TetrixPiece currentPiece
TetrixPiece nextPiece
int currentLine
int currentPos
int showNext
int nLinesRemoved
int nPiecesDropped
int score
int level
int gameID
int nClearLines
int width
int height
int * boardPtr

Constructor & Destructor Documentation

GenericTetrix::GenericTetrix int  boardWidth = 10,
int  boardHeight = 22
 

Definition at line 26 of file gtetrix.cpp.

References board(), boardPtr, currentLine, currentPos, gameID, height, i, level, nClearLines, nLinesRemoved, nPiecesDropped, score, showNext, and width.

GenericTetrix::~GenericTetrix  )  [virtual]
 

Definition at line 48 of file gtetrix.cpp.

References boardPtr.


Member Function Documentation

int& GenericTetrix::board int  x,
int  y
[inline, private]
 

Definition at line 85 of file gtetrix.h.

References boardPtr, and width.

Referenced by canMoveTo(), canPosition(), clearBoard(), fillRandom(), GenericTetrix(), gluePiece(), hideBoard(), removeFullLines(), showBoard(), and updateBoard().

int GenericTetrix::boardHeight  )  [inline]
 

Definition at line 56 of file gtetrix.h.

References height.

Referenced by QTetrixBoard::drawContents(), and QTetrix::resizeEvent().

int GenericTetrix::boardWidth  )  [inline]
 

Definition at line 57 of file gtetrix.h.

References width.

Referenced by QTetrixBoard::drawContents(), and QTetrix::resizeEvent().

int GenericTetrix::canMoveTo int  xPosition,
int  line
[private]
 

Definition at line 435 of file gtetrix.cpp.

References board(), currentLine, currentPiece, TetrixPiece::getCoord(), height, i, width, Opie::MM::x, and Opie::MM::y.

Referenced by dropDown(), moveLeft(), moveRight(), newPiece(), and oneLineDown().

int GenericTetrix::canPosition TetrixPiece piece  )  [private]
 

Definition at line 415 of file gtetrix.cpp.

References board(), currentLine, currentPos, TetrixPiece::getCoord(), height, i, width, Opie::MM::x, and Opie::MM::y.

Referenced by rotateLeft(), and rotateRight().

void GenericTetrix::clearBoard int  fillRandomLines = 0  ) 
 

Definition at line 54 of file gtetrix.cpp.

References board(), draw(), erasePiece(), fillRandom(), height, i, nClearLines, and width.

Referenced by startGame().

void GenericTetrix::draw int  x,
int  y,
int  value
[inline, private]
 

Definition at line 70 of file gtetrix.h.

References drawSquare(), and height.

Referenced by clearBoard(), erasePiece(), fillRandom(), hideBoard(), optimizedMove(), removeFullLines(), showBoard(), showPiece(), and updateBoard().

void GenericTetrix::drawNextSquare int  x,
int  y,
int  value
[virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 270 of file gtetrix.cpp.

Referenced by showNextPiece().

virtual void GenericTetrix::drawSquare int  x,
int  y,
int  value
[pure virtual]
 

Implemented in QTetrixBoard.

Referenced by draw().

void GenericTetrix::dropDown  ) 
 

Definition at line 217 of file gtetrix.cpp.

References canMoveTo(), currentLine, currentPos, internalPieceDropped(), and moveTo().

Referenced by QTetrixBoard::keyPressEvent().

void GenericTetrix::eraseNextPiece  )  [inline, private]
 

Definition at line 78 of file gtetrix.h.

References showNextPiece().

Referenced by newPiece(), and revealNextPiece().

void GenericTetrix::erasePiece  )  [private]
 

Definition at line 349 of file gtetrix.cpp.

References currentLine, currentPiece, currentPos, draw(), TetrixPiece::getCoord(), i, Opie::MM::x, and Opie::MM::y.

Referenced by clearBoard(), hideBoard(), and removePiece().

void GenericTetrix::fillRandom int  line  ) 
 

Definition at line 155 of file gtetrix.cpp.

References board(), draw(), i, TetrixPiece::randomValue(), and width.

Referenced by clearBoard().

virtual void GenericTetrix::gameOver  )  [pure virtual]
 

Implemented in QTetrixBoard.

Referenced by newPiece().

int GenericTetrix::getLevel  )  [inline]
 

Definition at line 55 of file gtetrix.h.

References level.

Referenced by QTetrixBoard::updateTimeoutTime().

int GenericTetrix::getLinesRemoved  )  [inline]
 

Definition at line 52 of file gtetrix.h.

References nLinesRemoved.

int GenericTetrix::getPiecesDropped  )  [inline]
 

Definition at line 53 of file gtetrix.h.

References nPiecesDropped.

int GenericTetrix::getScore  )  [inline]
 

Definition at line 54 of file gtetrix.h.

References score.

void GenericTetrix::gluePiece  )  [private]
 

Definition at line 376 of file gtetrix.cpp.

References board(), currentLine, currentPiece, currentPos, TetrixPiece::getCoord(), TetrixPiece::getMinY(), TetrixPiece::getType(), height, i, min, nClearLines, Opie::MM::x, and Opie::MM::y.

Referenced by internalPieceDropped().

void GenericTetrix::hideBoard  ) 
 

Definition at line 86 of file gtetrix.cpp.

References board(), draw(), erasePiece(), height, i, nClearLines, and width.

Referenced by QTetrixBoard::pause().

void GenericTetrix::internalPieceDropped int  dropHeight  )  [private]
 

Definition at line 362 of file gtetrix.cpp.

References gluePiece(), level, nPiecesDropped, pieceDropped(), removeFullLines(), score, updateLevel(), and updateScore().

Referenced by dropDown(), and oneLineDown().

void GenericTetrix::moveLeft int  steps = 1  ) 
 

Definition at line 175 of file gtetrix.cpp.

References canMoveTo(), currentLine, currentPos, and moveTo().

Referenced by QTetrixBoard::keyPressEvent().

void GenericTetrix::moveRight int  steps = 1  ) 
 

Definition at line 185 of file gtetrix.cpp.

References canMoveTo(), currentLine, currentPos, and moveTo().

Referenced by QTetrixBoard::keyPressEvent().

void GenericTetrix::moveTo int  xPosition,
int  line
[private]
 

Definition at line 454 of file gtetrix.cpp.

References currentLine, currentPiece, currentPos, and optimizedMove().

Referenced by dropDown(), moveLeft(), moveRight(), and oneLineDown().

void GenericTetrix::newPiece  ) 
 

Definition at line 246 of file gtetrix.cpp.

References canMoveTo(), currentLine, currentPiece, currentPos, eraseNextPiece(), gameOver(), TetrixPiece::getMinY(), height, nextPiece, TetrixPiece::setRandomType(), showNext, showNextPiece(), showPiece(), and width.

Referenced by QTetrixBoard::pieceDropped(), pieceDropped(), startGame(), and QTetrixBoard::timeout().

int GenericTetrix::noOfClearLines  )  [inline]
 

Definition at line 51 of file gtetrix.h.

References nClearLines.

void GenericTetrix::oneLineDown  ) 
 

Definition at line 235 of file gtetrix.cpp.

References canMoveTo(), currentLine, currentPos, internalPieceDropped(), and moveTo().

Referenced by QTetrixBoard::keyPressEvent(), and QTetrixBoard::timeout().

void GenericTetrix::optimizedMove int  newPos,
int  newLine,
TetrixPiece newPiece
[private]
 

Definition at line 471 of file gtetrix.cpp.

References currentLine, currentPiece, currentPos, draw(), TetrixPiece::getCoord(), TetrixPiece::getType(), i, Opie::MM::x, and Opie::MM::y.

Referenced by moveTo(), and position().

void GenericTetrix::pieceDropped int  dropHeight  )  [virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 275 of file gtetrix.cpp.

References newPiece().

Referenced by internalPieceDropped().

void GenericTetrix::position TetrixPiece piece  )  [private]
 

Definition at line 463 of file gtetrix.cpp.

References currentLine, currentPos, and optimizedMove().

Referenced by rotateLeft(), and rotateRight().

void GenericTetrix::removeFullLines  )  [private]
 

Definition at line 292 of file gtetrix.cpp.

References board(), draw(), height, i, nClearLines, nLinesRemoved, score, updateRemoved(), and width.

Referenced by internalPieceDropped().

void GenericTetrix::removeLine int  line  )  [private]
 

void GenericTetrix::removePiece  ) 
 

Definition at line 264 of file gtetrix.cpp.

References currentLine, and erasePiece().

void GenericTetrix::revealNextPiece int  revealIt  ) 
 

Definition at line 112 of file gtetrix.cpp.

References eraseNextPiece(), showNext, and showNextPiece().

Referenced by QTetrix::QTetrix().

void GenericTetrix::rotateLeft  ) 
 

Definition at line 195 of file gtetrix.cpp.

References canPosition(), currentPiece, position(), and TetrixPiece::rotateLeft().

Referenced by QTetrixBoard::keyPressEvent().

void GenericTetrix::rotateRight  ) 
 

Definition at line 206 of file gtetrix.cpp.

References canPosition(), currentPiece, position(), and TetrixPiece::rotateRight().

void GenericTetrix::showBoard  ) 
 

Definition at line 75 of file gtetrix.cpp.

References board(), draw(), height, i, nClearLines, showPiece(), and width.

void GenericTetrix::showNextPiece int  erase = 0  )  [private]
 

Definition at line 393 of file gtetrix.cpp.

References drawNextSquare(), TetrixPiece::getCoord(), TetrixPiece::getMaxX(), TetrixPiece::getMaxY(), TetrixPiece::getMinX(), TetrixPiece::getMinY(), TetrixPiece::getType(), i, nextPiece, Opie::MM::x, and Opie::MM::y.

Referenced by eraseNextPiece(), newPiece(), revealNextPiece(), and updateNext().

void GenericTetrix::showPiece  )  [private]
 

Definition at line 336 of file gtetrix.cpp.

References currentLine, currentPiece, currentPos, draw(), TetrixPiece::getCoord(), TetrixPiece::getType(), i, Opie::MM::x, and Opie::MM::y.

Referenced by newPiece(), showBoard(), and updateBoard().

void GenericTetrix::startGame int  gameType = 0,
int  fillRandomLines = 0
[virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 97 of file gtetrix.cpp.

References clearBoard(), gameID, height, level, nClearLines, newPiece(), nLinesRemoved, nPiecesDropped, score, updateLevel(), updateRemoved(), and updateScore().

Referenced by QTetrixBoard::startGame().

void GenericTetrix::updateBoard int  x1,
int  y1,
int  x2,
int  y2,
int  dontUpdateBlanks = 0
 

Definition at line 123 of file gtetrix.cpp.

References board(), draw(), height, i, showPiece(), and width.

Referenced by QTetrixBoard::drawContents().

void GenericTetrix::updateLevel int  newLevel  )  [virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 288 of file gtetrix.cpp.

Referenced by internalPieceDropped(), and startGame().

void GenericTetrix::updateNext  )  [inline]
 

Reimplemented in QTetrixBoard.

Definition at line 37 of file gtetrix.h.

References showNext, and showNextPiece().

Referenced by QTetrixBoard::updateNext().

void GenericTetrix::updateRemoved int  noOfLines  )  [virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 280 of file gtetrix.cpp.

Referenced by removeFullLines(), and startGame().

void GenericTetrix::updateScore int  newScore  )  [virtual]
 

Reimplemented in QTetrixBoard.

Definition at line 284 of file gtetrix.cpp.

Referenced by internalPieceDropped(), and startGame().


Member Data Documentation

int* GenericTetrix::boardPtr [private]
 

Definition at line 100 of file gtetrix.h.

Referenced by board(), GenericTetrix(), and ~GenericTetrix().

int GenericTetrix::currentLine [private]
 

Definition at line 89 of file gtetrix.h.

Referenced by canMoveTo(), canPosition(), dropDown(), erasePiece(), GenericTetrix(), gluePiece(), moveLeft(), moveRight(), moveTo(), newPiece(), oneLineDown(), optimizedMove(), position(), removePiece(), and showPiece().

TetrixPiece GenericTetrix::currentPiece [private]
 

Definition at line 87 of file gtetrix.h.

Referenced by canMoveTo(), erasePiece(), gluePiece(), moveTo(), newPiece(), optimizedMove(), rotateLeft(), rotateRight(), and showPiece().

int GenericTetrix::currentPos [private]
 

Definition at line 90 of file gtetrix.h.

Referenced by canPosition(), dropDown(), erasePiece(), GenericTetrix(), gluePiece(), moveLeft(), moveRight(), moveTo(), newPiece(), oneLineDown(), optimizedMove(), position(), and showPiece().

int GenericTetrix::gameID [private]
 

Definition at line 96 of file gtetrix.h.

Referenced by GenericTetrix(), and startGame().

int GenericTetrix::height [private]
 

Definition at line 99 of file gtetrix.h.

Referenced by boardHeight(), canMoveTo(), canPosition(), clearBoard(), draw(), GenericTetrix(), gluePiece(), hideBoard(), newPiece(), removeFullLines(), showBoard(), startGame(), and updateBoard().

int GenericTetrix::level [private]
 

Definition at line 95 of file gtetrix.h.

Referenced by GenericTetrix(), getLevel(), internalPieceDropped(), and startGame().

int GenericTetrix::nClearLines [private]
 

Definition at line 97 of file gtetrix.h.

Referenced by clearBoard(), GenericTetrix(), gluePiece(), hideBoard(), noOfClearLines(), removeFullLines(), showBoard(), and startGame().

TetrixPiece GenericTetrix::nextPiece [private]
 

Definition at line 88 of file gtetrix.h.

Referenced by newPiece(), and showNextPiece().

int GenericTetrix::nLinesRemoved [private]
 

Definition at line 92 of file gtetrix.h.

Referenced by GenericTetrix(), getLinesRemoved(), removeFullLines(), and startGame().

int GenericTetrix::nPiecesDropped [private]
 

Definition at line 93 of file gtetrix.h.

Referenced by GenericTetrix(), getPiecesDropped(), internalPieceDropped(), and startGame().

int GenericTetrix::score [private]
 

Definition at line 94 of file gtetrix.h.

Referenced by GenericTetrix(), getScore(), internalPieceDropped(), removeFullLines(), and startGame().

int GenericTetrix::showNext [private]
 

Definition at line 91 of file gtetrix.h.

Referenced by GenericTetrix(), newPiece(), revealNextPiece(), and updateNext().

int GenericTetrix::width [private]
 

Definition at line 98 of file gtetrix.h.

Referenced by board(), boardWidth(), canMoveTo(), canPosition(), clearBoard(), fillRandom(), GenericTetrix(), hideBoard(), newPiece(), removeFullLines(), showBoard(), and updateBoard().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:33:39 2005 for OPIE by  doxygen 1.4.2