Sign in to follow this  

[MDX] Creating hitpoints

This topic is 4162 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

Is it possible to for example draw a some custom shape, lets say a triangle and then add a mouseover event for the triangle? The figure should be drawn using vertexes with vertexbuffer. I asked similar question a while back, and I was instructed to go to Chad's homepage and after I looked the GUI tutorials (23-26) I noticed that they are really complex and the tutorials doesn't show how to make other shapes than a rectangle. [Edited by - Hoover85 on July 20, 2006 2:44:15 AM]

Share this post


Link to post
Share on other sites
Quote:
Is it possible to for example draw a some custom shape, lets say a triangle and then add a mouseover event for the triangle?

Yes, it's possible.
You can approach this one of many ways, the one might be to provide an event that accepts an object as a parameter and then check which primitive shape it is and depending on that extract information such as the location of the shape, the area the shape occupies and then check whether the mouse coordinates fall within that region.

That's as simply said as I can say it. You could poll/check this every x seconds or so.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Armadon, that sounds pretty much what I was thinking too. The real issue is that when the user moves the mouse over an object, then how in the world am I going to calculate all the coordinates where the hit point is? I mean if it's a triangle:


/\ /|
/ \ / |
/ \ / |
------ or /___|

These triangles might even be in a different angle, like rotated x degrees in 2D space, then calculating the pixels where is a hit point gets a lot harder. :o

Rectangles are pretty easy to calculate, when you can just calculate area when you know top-left and bottom-right coordinates, but even this gets tricky when the rectangle is rotated some degrees.

Round shape should be quite easy, because the coordinates don't change no matter how you rotate it.

[Edited by - Hoover85 on July 21, 2006 6:24:04 AM]

Share this post


Link to post
Share on other sites

This topic is 4162 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this