From 38ee6156f85ec7fbda2f9ad920bb0a8c7cdd22c5 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 28 Jul 2019 19:04:30 +0200 Subject: [PATCH] Update textures_mouse_painting.c --- examples/textures/textures_mouse_painting.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/textures/textures_mouse_painting.c b/examples/textures/textures_mouse_painting.c index 1c51d9d9..0149176c 100644 --- a/examples/textures/textures_mouse_painting.c +++ b/examples/textures/textures_mouse_painting.c @@ -69,12 +69,14 @@ int main(void) //---------------------------------------------------------------------------------- Vector2 mousePos = GetMousePosition(); - // Switch between colors + // Move between colors with keys if (IsKeyPressed(KEY_RIGHT)) colorSelected++; else if (IsKeyPressed(KEY_LEFT)) colorSelected--; - else if (IsKeyPressed(KEY_UP)) colorSelected -= 3; - else if (IsKeyPressed(KEY_DOWN)) colorSelected += 3; + if (colorSelected >= MAX_COLORS_COUNT) colorSelected = MAX_COLORS_COUNT - 1; + else if (colorSelected < 0) colorSelected = 0; + + // Choose color with mouse for (int i = 0; i < MAX_COLORS_COUNT; i++) { if (CheckCollisionPointRec(mousePos, colorsRecs[i])) @@ -91,9 +93,6 @@ int main(void) colorSelectedPrev = colorSelected; } - if (colorSelected >= MAX_COLORS_COUNT) colorSelected = MAX_COLORS_COUNT - 1; - else if (colorSelected < 0) colorSelected = 0; - // Change brush size brushSize += GetMouseWheelMove()*5; if (brushSize < 2) brushSize = 2; @@ -145,6 +144,7 @@ int main(void) if (showSaveMessage) { + // On saving, show a full screen message for 2 seconds saveMessageCounter++; if (saveMessageCounter > 240) { @@ -187,6 +187,7 @@ int main(void) DrawRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover? RED : BLACK); DrawText("SAVE!", 755, 20, 10, btnSaveMouseHover? RED : BLACK); + // Draw save image message if (showSaveMessage) { DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));