../
kernel
functions
add
all
apply_delta
assert
atan2
btn
btnp
camera
cd
char
chooser
circ
circfill
clip
cls
color
cos
count
cp
create_delta
create_gui
create_process
cursor
date
del
deli
env
error
exit
fetch
fetch_metadata
fget
fillp
foreach
fset
fstat
fullpath
get_clipboard
get_display
get_draw_target
get_spr
include
input
key
keyp
line
ls
map
max
memcpy
memmap
memset
menuitem
mget
mkdir
mouse
mouselock
mset
music
mv
note
on_event
open
oval
ovalfill
peek
peek2
peek4
peek8
peektext
pget
pid
pod
poke
poke2
poke4
poke8
printh
pset
pwd
readtext
rect
rectfill
rm
rrect
rrectfill
scoresub
send_message
set_clipboard
set_draw_target
set_spr
sfx
sin
socket
split
spr
sspr
stat
stop
store
store_metadata
sub
time
tokenoid
type
unmap
unpod
userdata
vec
vid
window
mouselock(lock, event_sensitivity, move_sensitivity)
Overview
mouselock is used to make a request to the host operating system's window manager to capture the mouse, allowing for it to control sensitivity and movement speed.
This returns the relative position since the last frame
Arguments
lock: boolean
Whether to lock the mouse or not
event_sensitivity: number
A number between 0 and 4 that determines how fast dx,dy changes (1.0 == 1/picotron pixel)
move_sensitivity: number
A number between 0 and 4 that determines the mouse sensitivity (1.0 == normal speed)
Returns
dx: number
The distance on the x-axis that the mouse pointer has moved
dy: number
The distance on the y-axis that the mouse pointer has moved
Example
Sourced from the Picotron Manual
local size, col = 20, 16
function _draw()
cls()
circfill(240, 135, size*4, col)
local _,_,mb = mouse()
dx,dy = mouselock(mb > 0, 0.05, 0) -- dx,dy change slowly, stop mouse moving
size += dx -- left,right to control size
col += dy -- up,down to control colour
end