Jump to content

Mouse position: Difference between revisions

Added XPL0
No edit summary
(Added XPL0)
Line 580:
Me.Print "Y:" & Pt.Y
End Sub</lang>
 
=={{header|XPL0}}==
GetMousePosition(0) = X coordinate; 1 = Y coordinate. For video modes
$0..$E and $13 the maximum coordinates are 639x199, minus the size of the
pointer. For modes $F..$12 the coordinates are the same as the pixels.
VESA graphic modes are (usually) 639x479 regardless of the resolution.
For 80-column text modes divide the mouse coordinates by 8 to get the
character cursor position.
 
The mouse cursor location is always relative to the upper-left corner of
the screen. A window may be externally created ... using a fair amount of
code because the version of XPL0 used with these Rosetta Code examples
does not make Windows applications (however see "Simple windowed application").
 
<lang XPL0>include c:\cxpl\stdlib;
if not OpenMouse then Text(0, "A mouse is required")
else [ShowMouse(true);
IntOut(0, GetMousePosition(0)); ChOut(0, ^,);
IntOut(0, GetMousePosition(1)); CrLf(0);
]</lang>
 
Example output:
<pre>
320,96
</pre>
 
 
{{omit from|ACL2}}
772

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.