Difference between revisions of "83Plus:Software:usb8x/BASIC Interface/MouseDo"
(→Notes: errTimeout) |
|||
Line 23: | Line 23: | ||
X and Y dimension movement are returned in a somewhat strange format. If the number is between 1 and 127, the mouse was moved that many "ticks" to the right or down. If the number is between 128 and 255, the mouse was moved 256 minus that many ticks to the left or up. See the code example of details on how to convert these numbers to something that makes sense. | X and Y dimension movement are returned in a somewhat strange format. If the number is between 1 and 127, the mouse was moved that many "ticks" to the right or down. If the number is between 128 and 255, the mouse was moved 256 minus that many ticks to the left or up. See the code example of details on how to convert these numbers to something that makes sense. | ||
+ | |||
+ | If no changes in the mouse are reported within a certain length of time, MouseDo will return with an error code of [[../../Error_Codes|errTimeout]]. This is not an unrecoverable error, just ignore the rest of the output list for this particular iteration. | ||
== Example == | == Example == |
Revision as of 14:07, 16 July 2006
Synopsis
Name: MouseDo
Function Number: 3
Minimum usb8x version: 0.07
Gets movement and keypress information from the mouse driver.
Inputs
None
Outputs
- 1: Error code
- 2: Button presses
- 3: X dimension movement
- 4: Y dimension movement
Notes
Be sure to initialize the mouse driver before calling this entry point.
Each bit of the 2nd output represents one button. So if the left mouse button is pressed the returned value will be 1. If the right mouse button is pressed it will be 2. If both are pressed it will be 3. Etc.
X and Y dimension movement are returned in a somewhat strange format. If the number is between 1 and 127, the mouse was moved that many "ticks" to the right or down. If the number is between 128 and 255, the mouse was moved 256 minus that many ticks to the left or up. See the code example of details on how to convert these numbers to something that makes sense.
If no changes in the mouse are reported within a certain length of time, MouseDo will return with an error code of [[../../Error_Codes|errTimeout]]. This is not an unrecoverable error, just ignore the rest of the output list for this particular iteration.
Example
See the [[../../Sample_Code#Mouse_Demo|Sample Code]] page for an example of using MouseDo, and for how to convert the x/y dimension movement outputs into useful values.
See Also
[[../MouseInit|MouseInit]] - Initialize the mouse driver.