aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2019-06-14 17:18:33 +0200
committerRay <raysan5@gmail.com>2019-06-14 17:18:33 +0200
commitdccd61bef9074bea715e8afb29b2043b4f4b66a3 (patch)
tree27386382c557deda4acbab7a6f2b60a8d36a0bb5 /src
parent9c991bd079679f6b74f85695570168916c311ef9 (diff)
downloadraylib-dccd61bef9074bea715e8afb29b2043b4f4b66a3.tar.gz
raylib-dccd61bef9074bea715e8afb29b2043b4f4b66a3.zip
Support new flag: FLAG_WINDOW_ALWAYS_RUN
Do not stop update/draw on window minimized WARNING: SetConfigFlag() was reviewed to support int flags
Diffstat (limited to 'src')
-rw-r--r--src/core.c8
-rw-r--r--src/raylib.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/core.c b/src/core.c
index 7b7fe240..fff7ab35 100644
--- a/src/core.c
+++ b/src/core.c
@@ -300,6 +300,7 @@ static int currentWidth, currentHeight; // Current render width and heig
static int renderOffsetX = 0; // Offset X from render area (must be divided by 2)
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
+static bool alwaysRun = false; // Keep window update/draw running on minimized
static Matrix screenScaling; // Matrix to scale screen (framebuffer rendering)
#if defined(PLATFORM_RPI)
@@ -421,7 +422,7 @@ static double targetTime = 0.0; // Desired time for one frame, if 0
// Config internal variables
//-----------------------------------------------------------------------------------
-static unsigned char configFlags = 0; // Configuration flags (bit based)
+static unsigned int configFlags = 0; // Configuration flags (bit based)
static bool showLogo = false; // Track if showing logo at init is enabled
static char **dropFilesPath; // Store dropped files paths as strings
@@ -798,7 +799,7 @@ bool WindowShouldClose(void)
if (windowReady)
{
// While window minimized, stop loop execution
- while (windowMinimized) glfwWaitEvents();
+ while (!alwaysRun && windowMinimized) glfwWaitEvents();
return (glfwWindowShouldClose(window));
}
@@ -1658,12 +1659,13 @@ Color Fade(Color color, float alpha)
}
// Setup window configuration flags (view FLAGS)
-void SetConfigFlags(unsigned char flags)
+void SetConfigFlags(unsigned int flags)
{
configFlags = flags;
if (configFlags & FLAG_SHOW_LOGO) showLogo = true;
if (configFlags & FLAG_FULLSCREEN_MODE) fullscreen = true;
+ if (configFlags & FLAG_WINDOW_ALWAYS_RUN) alwaysRun = true;
}
// NOTE TraceLog() function is located in [utils.h]
diff --git a/src/raylib.h b/src/raylib.h
index 9ce2e079..3056a53f 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -466,6 +466,7 @@ typedef enum {
FLAG_WINDOW_UNDECORATED = 8, // Set to disable window decoration (frame and buttons)
FLAG_WINDOW_TRANSPARENT = 16, // Set to allow transparent window
FLAG_WINDOW_HIDDEN = 128, // Set to create the window initially hidden
+ FLAG_WINDOW_ALWAYS_RUN = 256, // Set to allow windows running while minimized
FLAG_MSAA_4X_HINT = 32, // Set to try enabling MSAA 4X
FLAG_VSYNC_HINT = 64 // Set to try enabling V-Sync on GPU
} ConfigFlag;
@@ -924,7 +925,7 @@ RLAPI Color GetColor(int hexValue); // Returns a C
RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
// Misc. functions
-RLAPI void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS)
+RLAPI void SetConfigFlags(unsigned int flags); // Setup window configuration flags (view FLAGS)
RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
RLAPI void SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging