0 Members and 2 Guests are viewing this topic.
while(running){ while(SDL_PollEvent(&Event)) // Get key-presses and process them currentState->Event(&Event); currentState->Loop(); // Check gamelogic currentState->Render(); // Update screen}
Basically games are made up with a main loop. What happens is this:1. Game starts2. All the windows are set up and so on.3. You enter the main game loop4. The loop continually does the following: a. Get input, and process it b. All game logic (i.e. move sprites, updates positions, and checks collisions.) c. Update the screen d. Goto [a].5. Thats it Here is some Pseudo-code of the main loop.Code: [Select] while(running){ while(SDL_PollEvent(&Event)) // Get key-presses and process them currentState->Event(&Event); currentState->Loop(); // Check gamelogic currentState->Render(); // Update screen}