Sfoglia il codice sorgente

Review window creation hints

Ray 7 anni fa
parent
commit
9688c677de
4 ha cambiato i file con 19 aggiunte e 22 eliminazioni
  1. 1 1
      release/include/raylib.h
  2. BIN
      release/libs/win32/mingw32/libraylib.a
  3. 17 20
      src/core.c
  4. 1 1
      src/raylib.h

+ 1 - 1
release/include/raylib.h

@@ -92,7 +92,7 @@
 #define FLAG_SHOW_LOGO              1       // Set to show raylib logo at startup
 #define FLAG_FULLSCREEN_MODE        2       // Set to run program in fullscreen
 #define FLAG_WINDOW_RESIZABLE       4       // Set to allow resizable window
-#define FLAG_WINDOW_DECORATED       8       // Set to show window decoration (frame and buttons)
+#define FLAG_WINDOW_UNDECORATED     8       // Set to disable window decoration (frame and buttons)
 #define FLAG_WINDOW_TRANSPARENT    16       // Set to allow transparent window
 #define FLAG_MSAA_4X_HINT          32       // Set to try enabling MSAA 4X
 #define FLAG_VSYNC_HINT            64       // Set to try enabling V-Sync on GPU

BIN
release/libs/win32/mingw32/libraylib.a


+ 17 - 20
src/core.c

@@ -1884,31 +1884,28 @@ static bool InitGraphicsDevice(int width, int height)
     displayHeight = screenHeight;
 #endif  // defined(PLATFORM_WEB)
 
-    glfwDefaultWindowHints();                       // Set default windows hints
+    glfwDefaultWindowHints();                   // Set default windows hints:
+    //glfwWindowHint(GLFW_RED_BITS, 8);             // Framebuffer red color component bits
+    //glfwWindowHint(GLFW_GREEN_BITS, 8);           // Framebuffer green color component bits
+    //glfwWindowHint(GLFW_BLUE_BITS, 8);            // Framebuffer blue color component bits
+    //glfwWindowHint(GLFW_ALPHA_BITS, 8);           // Framebuffer alpha color component bits
+    //glfwWindowHint(GLFW_DEPTH_BITS, 24);          // Depthbuffer bits
+    //glfwWindowHint(GLFW_REFRESH_RATE, 0);         // Refresh rate for fullscreen window
+    //glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
+    //glfwWindowHint(GLFW_AUX_BUFFERS, 0);          // Number of auxiliar buffers
 
     // Check some Window creation flags
-    if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);   // Resizable window
+    if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);       // Resizable window
     else glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);  // Avoid window being resizable
 
-    if (configFlags & FLAG_WINDOW_DECORATED) glfwWindowHint(GLFW_DECORATED, GL_TRUE);   // Border and buttons on Window
+    if (configFlags & FLAG_WINDOW_UNDECORATED) glfwWindowHint(GLFW_DECORATED, GL_FALSE);    // Border and buttons on Window
+    else glfwWindowHint(GLFW_DECORATED, GL_TRUE);   // Decorated window
     
-    if (configFlags & FLAG_WINDOW_TRANSPARENT)
-    {
-        // TODO: Enable transparent window (not ready yet on GLFW 3.2)
-    }
+    if (configFlags & FLAG_WINDOW_TRANSPARENT) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);     // Transparent framebuffer
+    else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE);  // Opaque framebuffer
 
-    if (configFlags & FLAG_MSAA_4X_HINT)
-    {
-        glfwWindowHint(GLFW_SAMPLES, 4);            // Enables multisampling x4 (MSAA), default is 0
-        TraceLog(LOG_INFO, "Trying to enable MSAA x4");
-    }
+    if (configFlags & FLAG_MSAA_4X_HINT) glfwWindowHint(GLFW_SAMPLES, 4);   // Tries to enable multisampling x4 (MSAA), default is 0
     
-    //glfwWindowHint(GLFW_RED_BITS, 8);             // Framebuffer red color component bits
-    //glfwWindowHint(GLFW_DEPTH_BITS, 16);          // Depthbuffer bits (24 by default)
-    //glfwWindowHint(GLFW_REFRESH_RATE, 0);         // Refresh rate for fullscreen window
-    //glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);    // Default OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
-    //glfwWindowHint(GLFW_AUX_BUFFERS, 0);          // Number of auxiliar buffers
-
     // NOTE: When asking for an OpenGL context version, most drivers provide highest supported version
     // with forward compatibility to older OpenGL versions.
     // For example, if using OpenGL 1.1, driver can provide a 4.3 context forward compatible.
@@ -1926,11 +1923,11 @@ static bool InitGraphicsDevice(int width, int height)
         glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Profiles Hint: Only 3.3 and above!
                                                                        // Other values: GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE
 #if defined(__APPLE__)
-        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);  // OSX Requires
+        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);  // OSX Requires fordward compatibility
 #else
         glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE); // Fordward Compatibility Hint: Only 3.3 and above!
 #endif
-        //glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
+        //glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); // Request OpenGL DEBUG context
     }
 
     if (fullscreen)

+ 1 - 1
src/raylib.h

@@ -92,7 +92,7 @@
 #define FLAG_SHOW_LOGO              1       // Set to show raylib logo at startup
 #define FLAG_FULLSCREEN_MODE        2       // Set to run program in fullscreen
 #define FLAG_WINDOW_RESIZABLE       4       // Set to allow resizable window
-#define FLAG_WINDOW_DECORATED       8       // Set to show window decoration (frame and buttons)
+#define FLAG_WINDOW_UNDECORATED     8       // Set to disable window decoration (frame and buttons)
 #define FLAG_WINDOW_TRANSPARENT    16       // Set to allow transparent window
 #define FLAG_MSAA_4X_HINT          32       // Set to try enabling MSAA 4X
 #define FLAG_VSYNC_HINT            64       // Set to try enabling V-Sync on GPU