   SDL various issues
  Hello everyone. I'm developing a tetris clone with SDL and I have some problems.First of all, this is my main function:int main(int argc, char *argv[]) {grid newGrid(2, 1);tetraminos *current, *next, piece(6), piece2(5);current = &piece;next = &piece2;int counter = 0;bool done = false;SDL_Surface *screen;SDL_Event event;    if((SDL_Init(SDL_INIT_EVERYTHING)==-1)) {    return -1;    }screen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);if (screen == NULL)return -1;    while (( SDL_WaitEvent(&event) >= 0 ) || (!done)) {   switch (event.type) {  case SDL_QUIT: exit(0);  break;case SDL_KEYDOWN:Uint8 *keys; keys = SDL_GetKeyState(NULL); if ( keys[SDLK_LEFT] == SDL_PRESSED ) {current->x -= 1;if (!newGrid.canMove(*current))current->x += 1;// move tetraminos left } if ( keys[SDLK_RIGHT] == SDL_PRESSED ) {current->x += 1;if (!newGrid.canMove(*current))current->x -= 1;// move tetraminos right } if ( keys[SDLK_DOWN] == SDL_PRESSED ) {// move tetraminos down and place piece, then create a new tetraminoscurrent->y += 1;if (!newGrid.canMove(*current)) {current->y -= 1;newGrid.placePiece(*current, &done);current = next;// next = new tetraminos;} } if ( keys[SDLK_z] == SDL_PRESSED ) {current->rotateCounterClockWise();if (!newGrid.canRotate(*current))current->rotateClockwise();// rotate tetraminos counterclockwise } if ( keys[SDLK_x] == SDL_PRESSED ) {current->rotateClockwise();if (!newGrid.canRotate(*current))current->rotateCounterClockWise();// rotate tetraminos clockwise }break;   }counter++;if (counter == 100) {current->y += 1;if (!newGrid.canMove(*current)) {current->y -=1;newGrid.placePiece(*current, &done);current = next;// next = new tetraminos}}    }SDL_Quit();return 0;}As you can see is not polite, I would prefer a main function similar to this:int main(int argc, char *argv[]) {// sdl init stuff here    while (!done) {   scanInput();   newGrid.redraw();   current->draw();   playSounds();    }// sdl quitting stuff here}How can I do?Next, I would like to create new tetraminos and assign them to the next pointer, then draw the next tetraminos in a separate place on the screen and the current in the playfield.How can I call the constructors in order to allocate new tetraminos, assuming tetraminos is a class?Last, I don't remember where in the standard headers is the rnd function to init a random tetraminos in the constructor (which takes a single argument - the tetraminos type).Thanks in advance for any help.Bye, Berserk..   
  52 views and not a reply... nevermind however.I solved my problems in another forum.   ;Quote:Original post by Thc-03_Berserk52 views and not a reply... nevermind however.I solved my problems in another forum.If you post during some of the sites quieter times, your post will fall off the front pages and reduce the number of people who will find it dramatically. 52 views is actually a very small number for an active forum like this one. If you haven't gotten a reply in a day, then if you add a reply with a "bump" it will bring your post back to the top of the recent topics.Another issue is that your code appears unformatted and is difficult to read. If you had posted with the correct mark up tags ([source] and [/source] as specified in the FAQ) I'm sure more people would have been able to help.If I had seen your post I probably would have replied.   