Getting Mouse Input
Functions Introduced:
The functions
ProMousePickGet() and
ProMouseTrack() are used to read the position of the mouse, in screen coordinates. Each function outputs the position and an enumerated type description of which mouse buttons were pressed when the mouse was at that position. The values are defined in
ProGraphic.h, and are as follows:
• PRO_LEFT_BUTTON
• PRO_MIDDLE_BUTTON
• PRO_RIGHT_BUTTON
The function
ProMousePickGet() reports the mouse position only when you press a button. It has an input argument that is a description of the mouse buttons you want to wait for (you must have at least one). For example, you can set the
expected_button argument to:
PRO_LEFT_BUTTON | PRO_RIGHT_BUTTON
In this example, the function does not return until you press either the left or right button. You could also specify the value PRO_ANY_BUTTON.
The function
ProMouseTrack()returns whenever the mouse is moved, regardless of whether a button is pressed. Therefore, the function can return the value
PRO_NO_BUTTON. Its input argument enables you to control whether the reported positions are snapped to grid.