Procházet zdrojové kódy

Fix confusing legacy parameter names

Camilla Berglund před 9 roky
rodič
revize
d0649e6868
2 změnil soubory, kde provedl 36 přidání a 36 odebrání
  1. 3 3
      include/GLFW/glfw3.h
  2. 33 33
      src/window.c

+ 3 - 3
include/GLFW/glfw3.h

@@ -1634,8 +1634,8 @@ GLFWAPI void glfwDefaultWindowHints(void);
  *  glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
  *  terminated.
  *
- *  @param[in] target The [window hint](@ref window_hints) to set.
- *  @param[in] hint The new value of the window hint.
+ *  @param[in] hint The [window hint](@ref window_hints) to set.
+ *  @param[in] value The new value of the window hint.
  *
  *  @par Thread Safety
  *  This function must only be called from the main thread.
@@ -1647,7 +1647,7 @@ GLFWAPI void glfwDefaultWindowHints(void);
  *
  *  @ingroup window
  */
-GLFWAPI void glfwWindowHint(int target, int hint);
+GLFWAPI void glfwWindowHint(int hint, int value);
 
 /*! @brief Creates a window and its associated context.
  *

+ 33 - 33
src/window.c

@@ -270,104 +270,104 @@ void glfwDefaultWindowHints(void)
     _glfw.hints.refreshRate = GLFW_DONT_CARE;
 }
 
-GLFWAPI void glfwWindowHint(int target, int hint)
+GLFWAPI void glfwWindowHint(int hint, int value)
 {
     _GLFW_REQUIRE_INIT();
 
-    switch (target)
+    switch (hint)
     {
         case GLFW_RED_BITS:
-            _glfw.hints.framebuffer.redBits = hint;
+            _glfw.hints.framebuffer.redBits = value;
             break;
         case GLFW_GREEN_BITS:
-            _glfw.hints.framebuffer.greenBits = hint;
+            _glfw.hints.framebuffer.greenBits = value;
             break;
         case GLFW_BLUE_BITS:
-            _glfw.hints.framebuffer.blueBits = hint;
+            _glfw.hints.framebuffer.blueBits = value;
             break;
         case GLFW_ALPHA_BITS:
-            _glfw.hints.framebuffer.alphaBits = hint;
+            _glfw.hints.framebuffer.alphaBits = value;
             break;
         case GLFW_DEPTH_BITS:
-            _glfw.hints.framebuffer.depthBits = hint;
+            _glfw.hints.framebuffer.depthBits = value;
             break;
         case GLFW_STENCIL_BITS:
-            _glfw.hints.framebuffer.stencilBits = hint;
+            _glfw.hints.framebuffer.stencilBits = value;
             break;
         case GLFW_ACCUM_RED_BITS:
-            _glfw.hints.framebuffer.accumRedBits = hint;
+            _glfw.hints.framebuffer.accumRedBits = value;
             break;
         case GLFW_ACCUM_GREEN_BITS:
-            _glfw.hints.framebuffer.accumGreenBits = hint;
+            _glfw.hints.framebuffer.accumGreenBits = value;
             break;
         case GLFW_ACCUM_BLUE_BITS:
-            _glfw.hints.framebuffer.accumBlueBits = hint;
+            _glfw.hints.framebuffer.accumBlueBits = value;
             break;
         case GLFW_ACCUM_ALPHA_BITS:
-            _glfw.hints.framebuffer.accumAlphaBits = hint;
+            _glfw.hints.framebuffer.accumAlphaBits = value;
             break;
         case GLFW_AUX_BUFFERS:
-            _glfw.hints.framebuffer.auxBuffers = hint;
+            _glfw.hints.framebuffer.auxBuffers = value;
             break;
         case GLFW_STEREO:
-            _glfw.hints.framebuffer.stereo = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.framebuffer.stereo = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_DOUBLEBUFFER:
-            _glfw.hints.framebuffer.doublebuffer = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_SAMPLES:
-            _glfw.hints.framebuffer.samples = hint;
+            _glfw.hints.framebuffer.samples = value;
             break;
         case GLFW_SRGB_CAPABLE:
-            _glfw.hints.framebuffer.sRGB = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.framebuffer.sRGB = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_RESIZABLE:
-            _glfw.hints.window.resizable = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.resizable = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_DECORATED:
-            _glfw.hints.window.decorated = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.decorated = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_FOCUSED:
-            _glfw.hints.window.focused = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.focused = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_AUTO_ICONIFY:
-            _glfw.hints.window.autoIconify = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.autoIconify = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_FLOATING:
-            _glfw.hints.window.floating = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.floating = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_VISIBLE:
-            _glfw.hints.window.visible = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_CLIENT_API:
-            _glfw.hints.context.api = hint;
+            _glfw.hints.context.api = value;
             break;
         case GLFW_CONTEXT_VERSION_MAJOR:
-            _glfw.hints.context.major = hint;
+            _glfw.hints.context.major = value;
             break;
         case GLFW_CONTEXT_VERSION_MINOR:
-            _glfw.hints.context.minor = hint;
+            _glfw.hints.context.minor = value;
             break;
         case GLFW_CONTEXT_ROBUSTNESS:
-            _glfw.hints.context.robustness = hint;
+            _glfw.hints.context.robustness = value;
             break;
         case GLFW_OPENGL_FORWARD_COMPAT:
-            _glfw.hints.context.forward = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.context.forward = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_OPENGL_DEBUG_CONTEXT:
-            _glfw.hints.context.debug = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.context.debug = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_CONTEXT_NO_ERROR:
-            _glfw.hints.context.noerror = hint ? GLFW_TRUE : GLFW_FALSE;
+            _glfw.hints.context.noerror = value ? GLFW_TRUE : GLFW_FALSE;
             break;
         case GLFW_OPENGL_PROFILE:
-            _glfw.hints.context.profile = hint;
+            _glfw.hints.context.profile = value;
             break;
         case GLFW_CONTEXT_RELEASE_BEHAVIOR:
-            _glfw.hints.context.release = hint;
+            _glfw.hints.context.release = value;
             break;
         case GLFW_REFRESH_RATE:
-            _glfw.hints.refreshRate = hint;
+            _glfw.hints.refreshRate = value;
             break;
         default:
             _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");