MOUSEMOVEMENTY: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_MOUSEMOVEMENTY}} The _MOUSEMOVEMENTY function returns the relative vertical position of the mouse cursor as positive or negative values. {{PageSyntax}} : {{Parameter|verticalMove}} = _MOUSEMOVEMENTY * Returns the relative vertical cursor pixel position compared to the previous cursor position. Negative values are up moves. * '''Note:''' A _MOUSESHOW statement will disable _MOUSEMOVEMENTX or _MOUSEMOVEMENTY relative mouse movement...")
 
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:_MOUSEMOVEMENTY}}
{{DISPLAYTITLE:_MOUSEMOVEMENTY}}
The [[_MOUSEMOVEMENTY]] function returns the relative vertical position of the mouse cursor as positive or negative values.  
The [[_MOUSEMOVEMENTY]] function returns the relative vertical position of the mouse cursor as positive or negative values.




{{PageSyntax}}  
{{PageSyntax}}
: {{Parameter|verticalMove}} = [[_MOUSEMOVEMENTY]]
: {{Parameter|verticalMove}} = [[_MOUSEMOVEMENTY]]


Line 13: Line 13:




''Example:'' MOD is used to keep vertical movement of circle and cursor inside of the SCREEN 13 window(200).  
''Example:'' MOD is used to keep vertical movement of circle and cursor inside of the SCREEN 13 window(200).
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|SCREEN}} 13, , 1, 0
{{Cl|SCREEN}} 13, , 1, 0
{{Cl|DO...LOOP|DO}}: {{Cl|_LIMIT}} 200
{{Cl|DO...LOOP|DO}}: {{Cl|_LIMIT}} 200
Line 26: Line 26:
   {{Cl|CIRCLE}} (x, y), 20
   {{Cl|CIRCLE}} (x, y), 20
   {{Cl|PCOPY}} 1, 0
   {{Cl|PCOPY}} 1, 0
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> "" 'press any key to exit '' ''
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> "" 'press any key to exit
{{CodeEnd}}
{{CodeEnd}}
: '''NOTE:''' When using the function this way, give the user a keypress exit option. Make sure the user has some way to exit that is not dependent on clicking the X button.  
: '''NOTE:''' When using the function this way, give the user a keypress exit option. Make sure the user has some way to exit that is not dependent on clicking the X button.




Line 36: Line 36:
* [[_DEVICES]], [[_DEVICEINPUT]]
* [[_DEVICES]], [[_DEVICEINPUT]]
* [[_WHEEL]], [[_LASTWHEEL]]
* [[_WHEEL]], [[_LASTWHEEL]]
* [[_AXIS]], [[_LASTAXIS]]  
* [[_AXIS]], [[_LASTAXIS]]
* [[_MOUSESHOW]], [[_MOUSEHIDE]]
* [[_MOUSESHOW]], [[_MOUSEHIDE]]
* [[Screen Saver Programs]]
* [[Screen Saver Programs]]

Revision as of 02:08, 23 January 2023

The _MOUSEMOVEMENTY function returns the relative vertical position of the mouse cursor as positive or negative values.


Syntax

verticalMove = _MOUSEMOVEMENTY


  • Returns the relative vertical cursor pixel position compared to the previous cursor position. Negative values are up moves.
  • Note: A _MOUSESHOW statement will disable _MOUSEMOVEMENTX or _MOUSEMOVEMENTY relative mouse movement reads.
  • Can also be used to check for any mouse movements to enable a program or close Screen Saver Programs.
  • Sets the mouse to a relative movement mode which can be read by _WHEEL instead of _AXIS as mouse device 2.


Example: MOD is used to keep vertical movement of circle and cursor inside of the SCREEN 13 window(200).

SCREEN 13, , 1, 0
DO: _LIMIT 200
  DO WHILE _MOUSEINPUT
    x = x + _MOUSEMOVEMENTX
    y = y + _MOUSEMOVEMENTY
  LOOP
  x = (x + 320) MOD 320 'keeps object on screen
  y = (y + 200) MOD 200 'remove if off screen moves are desired
  CLS
  CIRCLE (x, y), 20
  PCOPY 1, 0
LOOP UNTIL INKEY$ <> "" 'press any key to exit
NOTE: When using the function this way, give the user a keypress exit option. Make sure the user has some way to exit that is not dependent on clicking the X button.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link