Question: Gaining Familiarity with OpenFrameworks and 2D Graphics (using Visual Studio or XCode) 1) Create a Rectangle class that maintains size, position and a bool state
Gaining Familiarity with OpenFrameworks and 2D Graphics
(using Visual Studio or XCode)
1) Create a Rectangle class that maintains size, position and a bool state variable to indicate if the rectangle is pressed down on with the mouse. Initialized the rectangle to initially be centered in your window with a width/height to be 100. Set to a default color of your choice.
2) When the mouse moves into the rectangle and the left mouse button is pressed, the button should turn from red to green (or any other color of your choice. When the mouse button is released the button should turn back to its original color .
3) When the mouse button is pressed in the rectangle and then dragged, the button should then move (by changing it's position) with the mouse pointer. Note that if the mouse pointer moves fast and momentarily leaves the boundaries of the rectangle while dragging, the rectangle should not stop. It should continue to move. Think of the mouse pointer being attached to a virtual rubber band while it is being dragged.
The program needs to be written in #C!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
