Mouse position: Difference between revisions

(Added Odin variant)
Line 1,089:
{Delay 250}
end</syntaxhighlight>
 
=={{header|Pebble}}==
<syntaxhighlight lang="basic">;mouse demonstration
;compile with Pebble
;for textmode x86 DOS
;requires mouse driver
 
program examples\mouse
 
use mouse.inc
 
data
 
int mousex[0]
int mousey[0]
int mouseb[0]
int speed[0]
int i[0]
 
begin
 
echo "Enter 1-200 for slow/DOS/emulated machines."
echo "Enter 500-20000 for faster/Windows machines."
input [speed]
 
cls
 
call showmouse
 
label mainloop
 
;clear mouse coordinates
 
cursor 0, 0
echo " "
echo " "
 
;get and display mouse coordinates
 
call readmouse
 
cursor 0, 0
echo [mousey]
crlf
echo [mousex]
 
;display exit button
 
cursor 76, 0
echo "[X]"
 
;check if exit button has been clicked
 
if [mouseb] = 1 & [mousex] >= 76 & [mousex] <= 79 & [mousey] = 0 then
 
kill
 
endif
 
;loop 100 times since some machines do not support the WAIT command
 
[i] = 0
 
label delay
 
+1 [i]
wait 1
 
if [i] < [speed] then delay
 
goto mainloop
 
end</syntaxhighlight>
 
=={{header|Perl}}==
305

edits