Browse Source

Added image saved message

pull/920/head
raysan5 5 years ago
parent
commit
895f9613d2
1 changed files with 20 additions and 0 deletions
  1. +20
    -0
      examples/textures/textures_mouse_painting.c

+ 20
- 0
examples/textures/textures_mouse_painting.c View File

@ -48,6 +48,8 @@ int main(void)
Rectangle btnSaveRec = { 750, 10, 40, 30 }; Rectangle btnSaveRec = { 750, 10, 40, 30 };
bool btnSaveMouseHover = false; bool btnSaveMouseHover = false;
bool showSaveMessage = false;
int saveMessageCounter = 0;
// Create a RenderTexture2D to use as a canvas // Create a RenderTexture2D to use as a canvas
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight); RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
@ -138,6 +140,17 @@ int main(void)
ImageFlipVertical(&image); ImageFlipVertical(&image);
ExportImage(image, "my_amazing_texture_painting.png"); ExportImage(image, "my_amazing_texture_painting.png");
UnloadImage(image); UnloadImage(image);
showSaveMessage = true;
}
if (showSaveMessage)
{
saveMessageCounter++;
if (saveMessageCounter > 240)
{
showSaveMessage = false;
saveMessageCounter = 0;
}
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -174,6 +187,13 @@ int main(void)
DrawRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover? RED : BLACK); DrawRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover? RED : BLACK);
DrawText("SAVE!", 755, 20, 10, btnSaveMouseHover? RED : BLACK); DrawText("SAVE!", 755, 20, 10, btnSaveMouseHover? RED : BLACK);
if (showSaveMessage)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
DrawRectangle(0, 150, GetScreenWidth(), 80, BLACK);
DrawText("IMAGE SAVED: my_amazing_texture_painting.png", 150, 180, 20, RAYWHITE);
}
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }

Loading…
Cancel
Save