diff options
| author | Lambert Wang <[email protected]> | 2021-05-08 09:26:24 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-08 18:26:24 +0200 |
| commit | 2545f62565fd246d1c59bf9a6bcf4942f4ad12ad (patch) | |
| tree | 817bd3580c3b7c4037a545d552d90f699be879b3 /examples/textures/textures_mouse_painting.c | |
| parent | 2565c011580fda074e0f3dceacd5e6a1476b3284 (diff) | |
| download | raylib-2545f62565fd246d1c59bf9a6bcf4942f4ad12ad.tar.gz raylib-2545f62565fd246d1c59bf9a6bcf4942f4ad12ad.zip | |
Added support for additional mouse buttons (#1753)
* Added support for additional mouse buttons
* Renamed mouse button enum
Co-authored-by: Lambert Wang <[email protected]>
Diffstat (limited to 'examples/textures/textures_mouse_painting.c')
| -rw-r--r-- | examples/textures/textures_mouse_painting.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/textures/textures_mouse_painting.c b/examples/textures/textures_mouse_painting.c index 5cfbe6e0..3001e853 100644 --- a/examples/textures/textures_mouse_painting.c +++ b/examples/textures/textures_mouse_painting.c @@ -88,7 +88,7 @@ int main(void) else colorMouseHover = -1; } - if ((colorMouseHover >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + if ((colorMouseHover >= 0) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { colorSelected = colorMouseHover; colorSelectedPrev = colorSelected; @@ -107,7 +107,7 @@ int main(void) EndTextureMode(); } - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) || (GetGestureDetected() == GESTURE_DRAG)) + if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || (GetGestureDetected() == GESTURE_DRAG)) { // Paint circle into render texture // NOTE: To avoid discontinuous circles, we could store @@ -117,7 +117,7 @@ int main(void) EndTextureMode(); } - if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) + if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) { if (!mouseWasPressed) { @@ -132,7 +132,7 @@ int main(void) if (mousePos.y > 50) DrawCircle((int)mousePos.x, (int)mousePos.y, brushSize, colors[0]); EndTextureMode(); } - else if (IsMouseButtonReleased(MOUSE_RIGHT_BUTTON) && mouseWasPressed) + else if (IsMouseButtonReleased(MOUSE_BUTTON_RIGHT) && mouseWasPressed) { colorSelected = colorSelectedPrev; mouseWasPressed = false; @@ -144,7 +144,7 @@ int main(void) // Image saving logic // NOTE: Saving painted texture to a default named image - if ((btnSaveMouseHover && IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) || IsKeyPressed(KEY_S)) + if ((btnSaveMouseHover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) || IsKeyPressed(KEY_S)) { Image image = GetTextureData(target.texture); ImageFlipVertical(&image); @@ -177,7 +177,7 @@ int main(void) // Draw drawing circle for reference if (mousePos.y > 50) { - if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) DrawCircleLines((int)mousePos.x, (int)mousePos.y, brushSize, GRAY); + if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) DrawCircleLines((int)mousePos.x, (int)mousePos.y, brushSize, GRAY); else DrawCircle(GetMouseX(), GetMouseY(), brushSize, colors[colorSelected]); } |
