I have a game menu with (for now) 1 picture (button). It’s a texture2D and I’ve put it in a array. I want to know when the mouse hovers over my picture. Actionscript had a built in function called “hitTestObject”. But it’s starting to look like I have to check every single pixel of the image to see if the mouse is on there. I’m open to changing everything, I just want to be able to pick different pictures.
Texture2D[] clickable_objects = new Texture2D[1];
clickable_objects[0] = Content.Load<Texture2D>("brain-icon");
public bool Intersects(Vector2 mouse_loc, Texture2D[] _objects)
{
int X = (int) mouse_loc.X;
int Y = (int) mouse_loc.Y;
if () //Mouse hovers over object[0]
return true;
else
return false;
}
Use Rectangle.Intersects