REVIEWED: TakeScreenshot() to support absolute paths
This commit is contained in:
parent
cfccb83ddd
commit
58e03dbc6c
1 changed files with 2 additions and 2 deletions
|
|
@ -1804,7 +1804,6 @@ void UnloadRandomSequence(int *sequence)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a screenshot of current screen
|
// Takes a screenshot of current screen
|
||||||
// NOTE: Provided fileName should not contain paths, saving to working directory
|
|
||||||
void TakeScreenshot(const char *fileName)
|
void TakeScreenshot(const char *fileName)
|
||||||
{
|
{
|
||||||
#if SUPPORT_MODULE_RTEXTURES
|
#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 };
|
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 };
|
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
|
ExportImage(image, path); // WARNING: Module required: rtextures
|
||||||
RL_FREE(imgData);
|
RL_FREE(imgData);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue