diff options
| author | victorfisac <victorfisac@gmail.com> | 2016-02-26 14:28:05 +0100 |
|---|---|---|
| committer | victorfisac <victorfisac@gmail.com> | 2016-02-26 14:28:05 +0100 |
| commit | 68088bc5be39beff4f9997fe0966ce30054f67c1 (patch) | |
| tree | ef7a773a5cd69193abce4e635dc1555cbd9ad9b7 /examples/core_input_mouse.c | |
| parent | 233f7611da96ea6bc0b7c62f6a06dacef707f9d7 (diff) | |
| parent | 0dfc7fffff68b0bfafd30a86fb322073daf7fc0e (diff) | |
| download | raylib-68088bc5be39beff4f9997fe0966ce30054f67c1.tar.gz raylib-68088bc5be39beff4f9997fe0966ce30054f67c1.zip | |
Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop
Diffstat (limited to 'examples/core_input_mouse.c')
| -rw-r--r-- | examples/core_input_mouse.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/core_input_mouse.c b/examples/core_input_mouse.c index 358b5fd6..24d2dfcd 100644 --- a/examples/core_input_mouse.c +++ b/examples/core_input_mouse.c @@ -21,6 +21,7 @@ int main() InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input"); Vector2 ballPosition = { -100.0f, -100.0f }; + Color ballColor = DARKBLUE; SetTargetFPS(60); //--------------------------------------------------------------------------------------- @@ -30,10 +31,11 @@ int main() { // Update //---------------------------------------------------------------------------------- - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - ballPosition = GetMousePosition(); - } + ballPosition = GetMousePosition(); + + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON; + else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME; + else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE; //---------------------------------------------------------------------------------- // Draw @@ -42,9 +44,9 @@ int main() ClearBackground(RAYWHITE); - DrawCircleV(ballPosition, 40, GOLD); + DrawCircleV(ballPosition, 40, ballColor); - DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY); + DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); EndDrawing(); //---------------------------------------------------------------------------------- |
