Mercurial > hg > forks > gldragon
changeset 64:e8100c1c5d99
Move option settings from globals to main().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 15 Dec 2019 02:53:49 +0200 |
parents | d6ffc59bb84d |
children | 71f6c5cc8eec |
files | gldragon.cpp |
diffstat | 1 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/gldragon.cpp Sat Dec 14 20:13:32 2019 +0200 +++ b/gldragon.cpp Sun Dec 15 02:53:49 2019 +0200 @@ -20,17 +20,14 @@ #define SET_MAX_SHADER_SIZE (128 * 1024) -/* Options - */ -bool optUseShaders = false; -int optWidth = SET_DEF_WIDTH, - optHeight = SET_DEF_HEIGHT, - optVSyncMode = 1; /* Helpers */ -bool dmInitSDL(DMSimpleRenderer &renderer, const int width, const int height, const char *title) +bool dmInitSDL(DMSimpleRenderer &renderer, + const int width, const int height, + const int vsyncMode, + const char *title) { int ret; std::string msg; @@ -50,7 +47,7 @@ return false; // Check if we want to attempt to use vsync - switch (optVSyncMode) + switch (vsyncMode) { case 3: ret = SDL_GL_SetSwapInterval(-1); @@ -97,15 +94,21 @@ int main(int argc, char *argv[]) { - int startTime, cycleStart, cycleFrames = 0, totalFrames = 0; - double totalTime; bool exitFlag = false, optShowHelp = false, - optSetInputFilename = false; + optSetInputFilename = false, + optUseShaders = false; + + int optWidth = SET_DEF_WIDTH, + optHeight = SET_DEF_HEIGHT, + optVSyncMode = 1; + std::string optInputFilename = "dragon.scene", basePath; DMGLSimpleRenderer renderer; DMSimpleScene scene; + int startTime, cycleStart, cycleFrames = 0, totalFrames = 0; + double totalTime; // Check commandline argument for enabling shaders for (int narg = 1; narg < argc; narg++) @@ -247,7 +250,7 @@ renderer.useShaders = optUseShaders; // Initialize SDL + OpenGL - if (!dmInitSDL(renderer, optWidth, optHeight, "GLDragon")) + if (!dmInitSDL(renderer, optWidth, optHeight, optVSyncMode, "GLDragon")) goto exit; // Compile shaders for scene