diff --git a/CorsixTH/Src/th_gfx.h b/CorsixTH/Src/th_gfx.h
index 1400288..7e792a5 100644
--- a/CorsixTH/Src/th_gfx.h
+++ b/CorsixTH/Src/th_gfx.h
@@ -96,14 +96,15 @@ enum THFrameFlags
THFF_AnimationStart = 1 << 0,
};
+/** Helper structure with parameters to create a #THRenderTarget. */
struct THRenderTargetCreationParams
{
- int iWidth;
- int iHeight;
- int iBPP;
- bool bFullscreen;
- bool bPresentImmediate;
- bool bReuseContext;
+ int iWidth; ///< Expected width of the render target.
+ int iHeight; ///< Expected height of the render target.
+ int iBPP; ///< Expected colour depth of the render target.
+ bool bFullscreen; ///< Run full-screen.
+ bool bPresentImmediate; ///< Whether to present immediately to the user (else wait for Vsync).
+ bool bReuseContext; ///< (not used)
};
/*!
diff --git a/CorsixTH/Src/th_lua_gfx.cpp b/CorsixTH/Src/th_lua_gfx.cpp
index 0b9bc2b..f8ea2cb 100644
--- a/CorsixTH/Src/th_lua_gfx.cpp
+++ b/CorsixTH/Src/th_lua_gfx.cpp
@@ -545,6 +545,7 @@ static int l_cursor_position(lua_State *L)
return 1;
}
+/** Construct the helper structure for making a #THRenderTarget. */
static THRenderTargetCreationParams l_surface_creation_params(lua_State *L, int iArgStart)
{
THRenderTargetCreationParams oParams;
@@ -555,21 +556,18 @@ static THRenderTargetCreationParams l_surface_creation_params(lua_State *L, int
oParams.bPresentImmediate = false;
oParams.bReuseContext = false;
-#define FLAG(name, field) \
- else if(stricmp(sOption, name) == 0) \
- oParams.field = true
-
+ // Parse string arguments, looking for matching parameter names.
for(int iArg = iArgStart + 2, iArgCount = lua_gettop(L); iArg <= iArgCount; ++iArg)
{
const char* sOption = luaL_checkstring(L, iArg);
if(sOption[0] == 0)
continue;
- FLAG("fullscreen", bFullscreen );
- FLAG("present immediate", bPresentImmediate );
- FLAG("reuse context", bReuseContext );
+
+ if (stricmp(sOption, "fullscreen") == 0) oParams.bFullscreen = true;
+ if (stricmp(sOption, "present immediate") == 0) oParams.bPresentImmediate = true;
+ if (stricmp(sOption, "reuse context") == 0) oParams.bReuseContext = true;
}
-#undef FLAG
return oParams;
}