Mercurial > hg > forks > gldragon
comparison gldragon.cpp @ 69:267b3fd2c98c
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 16 Dec 2019 06:51:40 +0200 |
parents | 1327ef5dc9fb |
children | 03aa729a9e90 |
comparison
equal
deleted
inserted
replaced
68:701bef61dcf1 | 69:267b3fd2c98c |
---|---|
320 // Check for errors | 320 // Check for errors |
321 renderer.checkErrors(); | 321 renderer.checkErrors(); |
322 | 322 |
323 // Return true if a full rotation was done | 323 // Return true if a full rotation was done |
324 totalFrames++; | 324 totalFrames++; |
325 if (cycleFrames++ == SET_FRAMES) | 325 cycleFrames++; |
326 { | 326 if (cycleFrames >= SET_FRAMES) |
327 // Reset cycleFrames | 327 { |
328 cycleFrames = 0; | |
329 | |
330 // Get the time it took to render a full turn | 328 // Get the time it took to render a full turn |
331 int cycleEnd = SDL_GetTicks(); | 329 int cycleEnd = SDL_GetTicks(); |
332 double cycleTime = cycleEnd - cycleStart; | 330 double cycleTime = cycleEnd - cycleStart; |
333 | 331 |
334 // Restart the timer | 332 // Restart the timer |
335 cycleStart = SDL_GetTicks(); | 333 cycleStart = SDL_GetTicks(); |
336 | 334 |
337 // Print the current frames per second | 335 // Print the current frames per second |
338 printf("%.1lf ms for %d frames = %.1lf FPS\n", | 336 printf("%.1lf ms for %d frames = %.1lf FPS\n", |
339 cycleTime, SET_FRAMES, (SET_FRAMES * 1000.0f) / cycleTime); | 337 cycleTime, cycleFrames, (cycleFrames * 1000.0f) / cycleTime); |
338 | |
339 // Reset cycleFrames | |
340 cycleFrames = 0; | |
340 } | 341 } |
341 } | 342 } |
342 | 343 |
343 // Show totals | 344 // Show totals |
344 totalTime = SDL_GetTicks() - startTime; | 345 totalTime = SDL_GetTicks() - startTime; |