Loading

Paste #pc1pwa3rx

  1. diff --git a/CorsixTH/Src/th_gfx.h b/CorsixTH/Src/th_gfx.h
  2. index 1400288..7e792a5 100644
  3. --- a/CorsixTH/Src/th_gfx.h
  4. +++ b/CorsixTH/Src/th_gfx.h
  5. @@ -96,14 +96,15 @@ enum THFrameFlags
  6.      THFF_AnimationStart = 1 << 0,
  7.  };
  8.  
  9. +/** Helper structure with parameters to create a #THRenderTarget. */
  10.  struct THRenderTargetCreationParams
  11.  {
  12. -    int iWidth;
  13. -    int iHeight;
  14. -    int iBPP;
  15. -    bool bFullscreen;
  16. -    bool bPresentImmediate;
  17. -    bool bReuseContext;
  18. +    int iWidth;             ///< Expected width of the render target.
  19. +    int iHeight;            ///< Expected height of the render target.
  20. +    int iBPP;               ///< Expected colour depth of the render target.
  21. +    bool bFullscreen;       ///< Run full-screen.
  22. +    bool bPresentImmediate; ///< Whether to present immediately to the user (else wait for Vsync).
  23. +    bool bReuseContext;     ///< (not used)
  24.  };
  25.  
  26.  /*!
  27. diff --git a/CorsixTH/Src/th_lua_gfx.cpp b/CorsixTH/Src/th_lua_gfx.cpp
  28. index 0b9bc2b..f8ea2cb 100644
  29. --- a/CorsixTH/Src/th_lua_gfx.cpp
  30. +++ b/CorsixTH/Src/th_lua_gfx.cpp
  31. @@ -545,6 +545,7 @@ static int l_cursor_position(lua_State *L)
  32.      return 1;
  33.  }
  34.  
  35. +/** Construct the helper structure for making a #THRenderTarget. */
  36.  static THRenderTargetCreationParams l_surface_creation_params(lua_State *L, int iArgStart)
  37.  {
  38.      THRenderTargetCreationParams oParams;
  39. @@ -555,21 +556,18 @@ static THRenderTargetCreationParams l_surface_creation_params(lua_State *L, int
  40.      oParams.bPresentImmediate = false;
  41.      oParams.bReuseContext = false;
  42.  
  43. -#define FLAG(name, field) \
  44. -    else if(stricmp(sOption, name) == 0) \
  45. -        oParams.field = true
  46. -
  47. +    // Parse string arguments, looking for matching parameter names.
  48.      for(int iArg = iArgStart + 2, iArgCount = lua_gettop(L); iArg <= iArgCount; ++iArg)
  49.      {
  50.          const char* sOption = luaL_checkstring(L, iArg);
  51.          if(sOption[0] == 0)
  52.              continue;
  53. -        FLAG("fullscreen",          bFullscreen       );
  54. -        FLAG("present immediate",   bPresentImmediate );
  55. -        FLAG("reuse context",       bReuseContext     );
  56. +
  57. +        if (stricmp(sOption, "fullscreen") == 0)        oParams.bFullscreen       = true;
  58. +        if (stricmp(sOption, "present immediate") == 0) oParams.bPresentImmediate = true;
  59. +        if (stricmp(sOption, "reuse context") == 0)     oParams.bReuseContext     = true;
  60.      }
  61.  
  62. -#undef FLAG
  63.      return oParams;
  64.  }

Comments