# HG changeset patch # User Matti Hamalainen # Date 1603019707 -10800 # Node ID 8b34eab13549448c1d04a9ba7bf66f763ef05b99 # Parent 036e9d737ba9bcd4d6aa60909e7343efc2de234d Add -p -option for pausing at specific cycle frame. diff -r 036e9d737ba9 -r 8b34eab13549 gldragon.cpp --- a/gldragon.cpp Mon Jul 06 18:49:21 2020 +0300 +++ b/gldragon.cpp Sun Oct 18 14:15:07 2020 +0300 @@ -103,7 +103,8 @@ int optWidth = SET_DEF_WIDTH, optHeight = SET_DEF_HEIGHT, - optVSyncMode = 1; + optVSyncMode = 1, + optPauseFrame = -1; std::string optInputFilename = "dragon.scene", basePath; DMGLSimpleRenderer renderer; @@ -140,6 +141,7 @@ case 's': case 'm': case 'v': + case 'p': { std::string marg; if (opt[1] == 0) @@ -172,7 +174,13 @@ } break; - case 'v': optVSyncMode = std::stoi(marg, 0, 0); break; + case 'v': + optVSyncMode = std::stoi(marg, 0, 0); + break; + + case 'p': + optPauseFrame = std::stoi(marg, 0, 0); + break; } } break; @@ -215,13 +223,15 @@ " Using vsync (2) will result in FPS being approximately\n" " whatever your monitor refresh rate is. The default\n" " value is 1 (no vsync).\n" + " -p Pause at cycle frame (max %d).\n" "\n" "Keyboard controls during runtime:\n" " p / space Toggle pause (does not/should not affect fps measurement)\n" " q / esc Quit\n" "\n", argv[0], - SET_DEF_WIDTH, SET_DEF_HEIGHT + SET_DEF_WIDTH, SET_DEF_HEIGHT, + SET_FRAMES ); goto exit; @@ -326,6 +336,9 @@ // Draw the current frame renderer.swapWindow(); + if (optPauseFrame >= 0 && cycleFrames == optPauseFrame) + pauseFlag = true; + // Rotate for 2 degrees if (!pauseFlag) renderer.animate(scene, totalTime);