void processInput(GameBoard& gb, char input) { switch (input) { case ' ': gb.drop(); break; case 'i': gb.rotate(); break; case 'j': gb.left(); break; case 'k': gb.down(); break; case 'l': gb.right(); break; default : return; } if (gb.touchDown()) { cout << "touch down!" << endl; gb.settlePiece(); int row = 0; for (int i = 0; i < 4; ++i) { row = gb.pos_y + gb.piece->points[i].y; if (gb.isFulledRow(row)) { gb.clearRow(row); cout << "clear Row!" << endl; showRealBoard(gb); _getch(); gb.dropDownRow(row); cout << "drop Down row" << endl; showRealBoard(gb); } } gb.addPiece(new Piece('O')); } }
int main() { GameBoard gameboard; gameboard.init(); gameboard.addPiece(new Piece('O')); gameboard.drop(); cout << gameboard; getch(); gameboard.settlePiece(); int row = 0; for (int i = 0; i < 4; ++i) { row = gameboard.pos_y + gameboard.piece->points[i].y; if (gameboard.isFulledRow(row)) { gameboard.clearRow(row); cout << "clear Row!" << endl; showRealBoard(gameboard); getch(); gameboard.dropDownRow(row); cout << "drop Down row" << endl; } } showRealBoard(gameboard); gameboard.finalize(); }