Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
dccd61bef9
2 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. +5
    -3
      src/core.c
  2. +2
    -1
      src/raylib.h

+ 5
- 3
src/core.c Näytä tiedosto

@ -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 (o">!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]

+ 2
- 1
src/raylib.h Näytä tiedosto

@ -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

Ladataan…
Peruuta
Tallenna