Jump to content
  • Advertisement
Sign in to follow this  
Oisin

SDL Game Not Responding

This topic is 2775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am attempting to implement a game loop for my basic game. My FPS lies at around 300 and I update the game state 50 times per second (I have tried 20 times as well). My problem, however, is that the game goes unresponsive when I attempt to move the window and it requires me to kill it with Alt-F4. Is the problem my code, the way I use SDL, or something else (like my update or render)?

Here's my code for the game loop:

while (is_running)
{
loops = 0;
while (GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP)
{
object_manager.updateObjects();
next_game_tick += SKIP_TICKS;
loops++;
}
renderer.drawObjects();
frameCount++;
if (GetTickCount() > startTime + 1000)
{
std::cout << "FPS: " << frameCount << std::endl;
frameCount = 0;
startTime += 1000;
}
}
return 0;


I have taken the game loop (and the variable naming convention) form: http://www.koonsolo.com/news/dewitters-gameloop/

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!