Checking mouse pos (Click button)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Frostfalk
Prole
Posts: 6
Joined: Tue Feb 10, 2009 9:42 am
Location: Sweden

Checking mouse pos (Click button)

Post by Frostfalk »

I did a quick search here on the forums and looked through the documentation. But I haven't found what I'm looking for. In the documentation, I saw only these commands:

Code: Select all

getX( )   	 Gets the current x-position of the mouse.
getY( ) 	Gets the current y-position of the mouse.
	
getPosition( ) 	Gets the current position of the mouse.
setPosition( x, y ) 	Sets the current position of the mouse.
	
isDown( button ) 	Checks whether a certain button is down.
	
setVisible( visible ) 	Controls cursor visbility.
isVisible( ) 	Checks cursor visbility. 
But there is one thing that bugs me. Is there no way to check where the cursor is? I'm supposed to make a clickable button, but I need to check if the cursor is on the button. I'm sure this one is quite easy, but I'm a novice so go easy on me. ^^

Please help this little guy out; will ya?

EDIT - Changed the Thread Title to make it fit the subject even more.
Solstickan
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Checking mouse pos (Click button)

Post by bartbes »

What's wrong with getX(), getY() and/or getPosition(), they do what you want. And if you want to check in the mousepressed callback it's even easier as it gets the position of the click as arguments.
Frostfalk
Prole
Posts: 6
Joined: Tue Feb 10, 2009 9:42 am
Location: Sweden

Re: Checking mouse pos (Click button)

Post by Frostfalk »

Thanks, I took a deeper look into the callback and it seems my answer is in there. I didn't see it at first. I'll try again and report back if I encounter more trouble.
Solstickan
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 196 guests