Added compile flag: SUPPORT_SCREEN_CAPTURE

Allow compiling the library with support for automatic screen capture
(KEY_F12)
This commit is contained in:
raysan5 2018-04-29 11:37:39 +02:00
parent 0045402c99
commit ca5f7ebd10
2 changed files with 9 additions and 0 deletions

View file

@ -44,6 +44,8 @@
#define SUPPORT_MOUSE_GESTURES 1 #define SUPPORT_MOUSE_GESTURES 1
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used // Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
#define SUPPORT_BUSY_WAIT_LOOP 1 #define SUPPORT_BUSY_WAIT_LOOP 1
// Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
#define SUPPORT_SCREEN_CAPTURE 1
// Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() // Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
#define SUPPORT_GIF_RECORDING 1 #define SUPPORT_GIF_RECORDING 1

View file

@ -50,6 +50,9 @@
* #define SUPPORT_BUSY_WAIT_LOOP * #define SUPPORT_BUSY_WAIT_LOOP
* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used * Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
* *
* #define SUPPORT_SCREEN_CAPTURE
* Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
*
* #define SUPPORT_GIF_RECORDING * #define SUPPORT_GIF_RECORDING
* Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() * Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
* *
@ -2791,10 +2794,12 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
} }
else else
#endif // SUPPORT_GIF_RECORDING #endif // SUPPORT_GIF_RECORDING
#if defined(SUPPORT_SCREEN_CAPTURE)
{ {
TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter)); TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter));
screenshotCounter++; screenshotCounter++;
} }
#endif // SUPPORT_SCREEN_CAPTURE
} }
#endif // PLATFORM_DESKTOP #endif // PLATFORM_DESKTOP
else else
@ -3456,12 +3461,14 @@ static void ProcessKeyboard(void)
// Check exit key (same functionality as GLFW3 KeyCallback()) // Check exit key (same functionality as GLFW3 KeyCallback())
if (currentKeyState[exitKey] == 1) windowShouldClose = true; if (currentKeyState[exitKey] == 1) windowShouldClose = true;
#if defined(SUPPORT_SCREEN_CAPTURE)
// Check screen capture key (raylib key: KEY_F12) // Check screen capture key (raylib key: KEY_F12)
if (currentKeyState[301] == 1) if (currentKeyState[301] == 1)
{ {
TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter)); TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter));
screenshotCounter++; screenshotCounter++;
} }
#endif
} }
// Restore default keyboard input // Restore default keyboard input