Browse Source

Support new flag: FLAG_WINDOW_ALWAYS_RUN

Do not stop update/draw on window minimized

WARNING: SetConfigFlag() was reviewed to support int flags
pull/892/head
Ray 5 years ago
parent
commit
dccd61bef9
2 changed files with 7 additions and 4 deletions
  1. +5
    -3
      src/core.c
  2. +2
    -1
      src/raylib.h

+ 5
- 3
src/core.c View File

@ -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 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 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 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) static Matrix screenScaling; // Matrix to scale screen (framebuffer rendering)
#if defined(PLATFORM_RPI) #if defined(PLATFORM_RPI)
@ -421,7 +422,7 @@ static double targetTime = 0.0; // Desired time for one frame, if 0
// Config internal variables // 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 bool showLogo = false; // Track if showing logo at init is enabled
static char **dropFilesPath; // Store dropped files paths as strings static char **dropFilesPath; // Store dropped files paths as strings
@ -798,7 +799,7 @@ bool WindowShouldClose(void)
if (windowReady) if (windowReady)
{ {
// While window minimized, stop loop execution // While window minimized, stop loop execution
while (windowMinimized) glfwWaitEvents();
while (o">!alwaysRun && windowMinimized) glfwWaitEvents();
return (glfwWindowShouldClose(window)); return (glfwWindowShouldClose(window));
} }
@ -1658,12 +1659,13 @@ Color Fade(Color color, float alpha)
} }
// Setup window configuration flags (view FLAGS) // Setup window configuration flags (view FLAGS)
void SetConfigFlags(unsigned char flags)
void SetConfigFlags(unsigned int flags)
{ {
configFlags = flags; configFlags = flags;
if (configFlags & FLAG_SHOW_LOGO) showLogo = true; if (configFlags & FLAG_SHOW_LOGO) showLogo = true;
if (configFlags & FLAG_FULLSCREEN_MODE) fullscreen = true; if (configFlags & FLAG_FULLSCREEN_MODE) fullscreen = true;
if (configFlags & FLAG_WINDOW_ALWAYS_RUN) alwaysRun = true;
} }
// NOTE TraceLog() function is located in [utils.h] // NOTE TraceLog() function is located in [utils.h]

+ 2
- 1
src/raylib.h View File

@ -466,6 +466,7 @@ typedef enum {
FLAG_WINDOW_UNDECORATED = 8, // Set to disable window decoration (frame and buttons) FLAG_WINDOW_UNDECORATED = 8, // Set to disable window decoration (frame and buttons)
FLAG_WINDOW_TRANSPARENT = 16, // Set to allow transparent window FLAG_WINDOW_TRANSPARENT = 16, // Set to allow transparent window
FLAG_WINDOW_HIDDEN = 128, // Set to create the window initially hidden 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_MSAA_4X_HINT = 32, // Set to try enabling MSAA 4X
FLAG_VSYNC_HINT = 64 // Set to try enabling V-Sync on GPU FLAG_VSYNC_HINT = 64 // Set to try enabling V-Sync on GPU
} ConfigFlag; } 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 RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
// Misc. functions // 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 SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
RLAPI void SetTraceLogExit(int logType); // Set the exit 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 RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging

Loading…
Cancel
Save