aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2019-07-28 19:04:30 +0200
committerraysan5 <raysan5@gmail.com>2019-07-28 19:04:30 +0200
commit38ee6156f85ec7fbda2f9ad920bb0a8c7cdd22c5 (patch)
tree2a61c0caf81155730658f96b2939469da94398ee /examples
parentb83d165764cd81de8bd5a0bb8260117787f419a4 (diff)
downloadraylib-38ee6156f85ec7fbda2f9ad920bb0a8c7cdd22c5.tar.gz
raylib-38ee6156f85ec7fbda2f9ad920bb0a8c7cdd22c5.zip
Update textures_mouse_painting.c
Diffstat (limited to 'examples')
-rw-r--r--examples/textures/textures_mouse_painting.c13
1 files 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));