tags:

views:

89

answers:

4

I'm making a game in c++. It is a card game. I have made 13 cards that rotate about a point to arc out to make your hand. I need a way to figure out which card the user clicks on. My cards are basically rectangles rotated about a point that is in the center of the cards. I was thinking of maybe getting the mouse point and rotating it about my central point but i'm not sure how to rotate a point about a point. Thanks.

+1  A: 
Dario
A: 
John Kugelman
A: 

You've gotten a couple of possibilities already. This is a rather different one that depends more on programming and less on trig.

The idea would be to draw each card in a unique, solid, color in a back buffer. Check the color at the point that matches the mouse click, and you have the card. At one time this would have been grossly impractical -- but with modern graphics hardware this can be quite competitive.

Jerry Coffin
A: 

You could check that point is a part of polygon. Here you could find pretty fast implementation.

Kirill V. Lyadvinsky