Merge pull request #719 from MarcoLizza/window-visibility
Window visibility
This commit is contained in:
commit
91ea007478
@ -15,6 +15,9 @@ RLAPI void SetWindowPosition(int x, int y); // Set window
|
||||
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
|
||||
RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
RLAPI void SetWindowSize(int width, int height); // Set window dimensions
|
||||
RLAPI void ShowWindow(); // Show the window
|
||||
RLAPI void HideWindow(); // Hide the window
|
||||
RLAPI bool IsWindowHidden(); // Check if window is currently hidden
|
||||
RLAPI int GetScreenWidth(void); // Get current screen width
|
||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||
|
||||
|
32
src/core.c
32
src/core.c
@ -826,6 +826,31 @@ void SetWindowSize(int width, int height)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Show the window
|
||||
void ShowWindow()
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
glfwShowWindow(window);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Hide the window
|
||||
void HideWindow()
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
glfwHideWindow(window);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if window is currently hidden
|
||||
bool IsWindowHidden()
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
return glfwGetWindowAttrib(window, GLFW_VISIBLE) == GL_FALSE;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get current screen width
|
||||
int GetScreenWidth(void)
|
||||
{
|
||||
@ -2257,8 +2282,11 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||
|
||||
// Check some Window creation flags
|
||||
if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
|
||||
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
|
||||
if (configFlags & FLAG_WINDOW_HIDDEN) glfwWindowHint(GLFW_VISIBLE, GL_FALSE); // Visible window
|
||||
else glfwWindowHint(GLFW_VISIBLE, GL_TRUE); // Window initially hidden
|
||||
|
||||
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_UNDECORATED) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
|
||||
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
|
||||
|
@ -415,8 +415,9 @@ typedef enum {
|
||||
FLAG_WINDOW_RESIZABLE = 4, // Set to allow resizable window
|
||||
FLAG_WINDOW_UNDECORATED = 8, // Set to disable window decoration (frame and buttons)
|
||||
FLAG_WINDOW_TRANSPARENT = 16, // Set to allow transparent window
|
||||
FLAG_MSAA_4X_HINT = 32, // Set to try enabling MSAA 4X
|
||||
FLAG_VSYNC_HINT = 64 // Set to try enabling V-Sync on GPU
|
||||
FLAG_WINDOW_HIDDEN = 32, // Set to create the window initially hidden
|
||||
FLAG_MSAA_4X_HINT = 64, // Set to try enabling MSAA 4X
|
||||
FLAG_VSYNC_HINT = 128 // Set to try enabling V-Sync on GPU
|
||||
} ConfigFlag;
|
||||
|
||||
// Trace log type
|
||||
@ -844,6 +845,9 @@ RLAPI void SetWindowPosition(int x, int y); // Set window
|
||||
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
|
||||
RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
RLAPI void SetWindowSize(int width, int height); // Set window dimensions
|
||||
RLAPI void ShowWindow(); // Show the window
|
||||
RLAPI void HideWindow(); // Hide the window
|
||||
RLAPI bool IsWindowHidden(); // Check if window is currently hidden
|
||||
RLAPI int GetScreenWidth(void); // Get current screen width
|
||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||
RLAPI void *GetWindowHandle(void); // Get native window handle
|
||||
|
Loading…
Reference in New Issue
Block a user