mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-30 20:37:47 +00:00
REVIEWED: TakeScreenshot() to support absolute paths
This commit is contained in:
@@ -1804,7 +1804,6 @@ void UnloadRandomSequence(int *sequence)
|
||||
}
|
||||
|
||||
// Takes a screenshot of current screen
|
||||
// NOTE: Provided fileName should not contain paths, saving to working directory
|
||||
void TakeScreenshot(const char *fileName)
|
||||
{
|
||||
#if SUPPORT_MODULE_RTEXTURES
|
||||
@@ -1819,7 +1818,8 @@ void TakeScreenshot(const char *fileName)
|
||||
Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||
|
||||
char path[MAX_FILEPATH_LENGTH] = { 0 };
|
||||
snprintf(path, MAX_FILEPATH_LENGTH, "%s", TextFormat("%s/%s", CORE.Storage.basePath, fileName));
|
||||
if (!IsPathAbsolute(fileName)) snprintf(path, MAX_FILEPATH_LENGTH, "%s", TextFormat("%s/%s", CORE.Storage.basePath, fileName));
|
||||
else snprintf(path, MAX_FILEPATH_LENGTH, "%s", fileName);
|
||||
|
||||
ExportImage(image, path); // WARNING: Module required: rtextures
|
||||
RL_FREE(imgData);
|
||||
|
||||
Reference in New Issue
Block a user