added a function for changing a piece's shape
This commit is contained in:
parent
cc0f4e3cf5
commit
072964dc6d
|
@ -117,3 +117,17 @@ void tetris_piece_rotate(tetris_piece_t *pPc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Function: tetris_piece_change
|
||||||
|
* Description: changes the shape of a piece
|
||||||
|
* Argument pPc: piece to change
|
||||||
|
* Argument shape: the shape of interest
|
||||||
|
* Return value: void
|
||||||
|
*/
|
||||||
|
void tetris_piece_change(tetris_piece_t *pPc,
|
||||||
|
tetris_piece_shape_t shape)
|
||||||
|
{
|
||||||
|
assert(pPc != NULL);
|
||||||
|
assert((shape >= 0) && (shape <= TETRIS_PC_Z));
|
||||||
|
|
||||||
|
pPc->shape = shape;
|
||||||
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ tetris_piece_t *tetris_piece_construct(tetris_piece_shape_t s,
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
/* Function: tetris_piece_getBitmap
|
/* Function: tetris_piece_getBitmap
|
||||||
* Description: returns bitfield representation of the piece
|
* Description: returns bitfield representation of the piece
|
||||||
* Argument pPc: piece from which the bitfield shuld be retrieved
|
* Argument pPc: piece from which the bitfield shuld be retrieved
|
||||||
* Return value: bitfield representation of the piece
|
* Return value: bitfield representation of the piece
|
||||||
* - nth nibble is nth row of the piece (from upper left)
|
* - nth nibble is nth row of the piece (from upper left)
|
||||||
|
@ -93,5 +93,14 @@ void tetris_piece_rotate(tetris_piece_t *pPc,
|
||||||
tetris_piece_rotation_t r);
|
tetris_piece_rotation_t r);
|
||||||
|
|
||||||
|
|
||||||
|
/* Function: tetris_piece_change
|
||||||
|
* Description: changes the shape of a piece
|
||||||
|
* Argument pPc: piece to change
|
||||||
|
* Argument shape: the shape of interest
|
||||||
|
* Return value: void
|
||||||
|
*/
|
||||||
|
void tetris_piece_change(tetris_piece_t *pPc,
|
||||||
|
tetris_piece_shape_t shape);
|
||||||
|
|
||||||
#endif /*TETRIS_PIECE_H_*/
|
#endif /*TETRIS_PIECE_H_*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue