int main(int argc, char* args[]) { //Key input code stolen straight from example. //Needs tweaking to make shape move but key selection works. while (!builder.IsKeyDown(SDLK_ESCAPE)) { engine.Run(); int mKey = builder.Pollkey(); switch (mKey) { case (SDLK_RIGHT) : { if (engine.checkCollision(engine.currentPositionX +1, engine.currentPositionY, engine.shapeType)) { engine.currentPositionX++; builder.clearScreen(); //printf("Right Key\n\n"); //printf("\n%d\n\n\n", engine.currentPositionX); } break; } case (SDLK_LEFT) : { if (engine.checkCollision(engine.currentPositionX -1, engine.currentPositionY, engine.shapeType)) { engine.currentPositionX--; builder.clearScreen(); //printf("Left Key\n"); //printf("\n%d\n\n\n", engine.currentPositionX); } break; } //Cool bug if down key is held. case (SDLK_DOWN) : { if (engine.checkCollision(engine.currentPositionX, engine.currentPositionY +1, engine.shapeType)) { engine.currentPositionY++; builder.clearScreen(); } break; } } // ----- Vertical movement ----- unsigned long mTime2 = SDL_GetTicks(); if ((mTime2 - mTime1) > WAIT_TIME) { //printf("Current Positoin of Y:\n%d\n\n\n", engine.currentPositionY); if (engine.checkCollision(engine.currentPositionX , engine.currentPositionY +1, engine.shapeType)) { engine.currentPositionY++; builder.clearScreen(); } else { gameBoard.storeShape(engine.currentPositionX, engine.currentPositionY, engine.shapeType); gameBoard.deleteLines(); engine.makeNextShape(); } mTime1 = SDL_GetTicks(); } } builder.CloseAll(); return 0; }