Function OnMouseDown

function OnMouseDown(x, y)
	...
end function

This is an event function you can overload in you prodram to react on mouse actions. (x, y) - are the coordinates of a point, where user pressed a mouse button. On Windows this event is firing when left mouse button is pressed. On touchscreen devices it is fired when user touches the screen. Example:

$Pony = #"pony.png"
$nWidth = GetImageWidth($Pony)
$nHeight = GetImageHeight($Pony)

function OnMouseDown(x, y)
	ClearScreen()
	DrawImage(x-$nWidth/2, y-$nHeight/2, $Pony)
end function

See also: