[MDX] Creating hitpoints

Started by
1 comment, last by Hoover85 17 years, 9 months ago
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]
Advertisement
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.
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]

This topic is closed to new replies.

Advertisement