I am modifying a piece of code that displays a polygon, a triangle in this case, to do the following tasks:
- If I click the mouse left button and keep it pressed, the triangle rotates to the left until I release such a button.
- If I click the mouse right button and keep it pressed, the triangle rotates to the right until I release such a button.
So far I have been able to do these changes successfully.
Now, I need to add the following:
- If, while pressing the left or right mouse button, I move it up then the rotation speed must increment.
- If, while pressing the left or right mouse button, I move it down then the rotation speed must decrement.
I must be able to click the right or left button at any screen location which would initially be the “home location”. From this “home location” I must detect when the mouse moves up/down and increment/decrement the rotation speed.
I have been trying several approaches without success so I kindly ask for your help in order to solve my issue.
I am attaching the code for your reference.
Any clue will be greatly appreciated.
Respectfully,
Jorge Maldonado