| 1 |
#ifndef _CBLOCK_ |
| 2 |
#define _CBLOCK_ |
| 3 |
|
| 4 |
#include <string> |
| 5 |
#include "oodle.h" |
| 6 |
#include "CFieldSprite.h" |
| 7 |
#include "util.h" |
| 8 |
using namespace std; |
| 9 |
|
| 10 |
//! A class to hold individual blocks. |
| 11 |
class CBlock : public CFieldSprite |
| 12 |
{ |
| 13 |
public: |
| 14 |
CBlock(const string& fileName, int x, int y, int fieldWidth, int fieldHeight, CVector offset, BlockType type); // fileName is the name of bitmap with static image for block |
| 15 |
CBlock(CSurface* s, int x, int y, int fieldWidth, int fieldHeight, CVector offset, BlockType type); |
| 16 |
|
| 17 |
void clear(); //! Clear this block (alive = false) |
| 18 |
void setActive(bool active); //! Set this->active = active |
| 19 |
// void setOffset(CVector offset) { CBlock::offset = offset; } |
| 20 |
// void moveBoardCords(int x, int y) { setPos( screenCords(x, y) ); boardX = x; boardY = y; } |
| 21 |
// void moveRelBoardCords(int dX, int dY) { setPos( screenCords( boardX + dX, boardY + dY ) ); boardX += dX; boardY += dY; } |
| 22 |
// void moveRelBoardCords(int dX, int dY, double vel); |
| 23 |
void update(); |
| 24 |
// void setDest(CVector d); |
| 25 |
|
| 26 |
bool deleteMe(); //! Should this block be deleted? |
| 27 |
bool isActive(); //! Is the block active? (False when it is falling) |
| 28 |
bool canRemove(); |
| 29 |
bool sameType(const CBlock &b); //! Is this block the same type as block b? |
| 30 |
|
| 31 |
CBlock* getClone(int x, int y); //! Get a clone at the specified point (in board cords) |
| 32 |
CBlock* getClone(int x, int y, CVector offset); //! Get a clone at the specified point (in board cords) |
| 33 |
CBlock* getClone(int x, int y, int fieldWidth, int fieldHeight, CVector offset); //! Get a clone at the specified point (in board cords) |
| 34 |
|
| 35 |
private: |
| 36 |
CBlock(const CBlock& b, int x, int y); //! Clone constructor |
| 37 |
CBlock(const CBlock& b, int x, int y, int fieldWidth, int fieldHeight, CVector offset); //! Clone constructor |
| 38 |
CBlock(const CBlock& b, int x, int y, CVector offset); //! Clone constructor |
| 39 |
|
| 40 |
//CVector screenCords(int x, int y); //! Convert from board coordinates to screen coordiantes using the offset |
| 41 |
|
| 42 |
bool active; |
| 43 |
BlockType type; |
| 44 |
//int boardX, boardY; |
| 45 |
//CVector offset; //! Vector to upper-lefthand corner of CPlayingField from (0,0) in screen cords |
| 46 |
// CVector dest; |
| 47 |
}; |
| 48 |
|
| 49 |
#endif |