Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OpenGL_Guru

How to know if mouse is over 2D Quad??

This topic is 5264 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am drawing a 2D quad and i need to know if the mouse pointer is anywhere on this quad. is there a basic windowing command or check to do this? i am already using glReadPixels somewhere else in my program for something else so i need to use something different for this. what i want to do is, is when the mouse is over the quad, then it will change color and i can then move the quad with the mouse back and forth when pressing down the left mouse button... any ideas or suggestions? thanks in advance..

Share this post


Link to post
Share on other sites
Advertisement

bool UI_PointInRect(vector2 max, vector2 min, vector2 p) {
if( (p.x >= min.x) && (p.x <= max.x) &&
(p.y >= min.y) && (p.y <= max.y) )
{
return true;
}
return false;
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!