2D Mouse Picking

Started by
3 comments, last by uemarko 15 years, 4 months ago
I'm new to PTK game engine and am happy with it so far. Does anyone here familiar with PTK know if it has an ability to handle mouse picking of 2D transparent objects in some particular way? If not, I'd like to hear the ways others handle it (disregarding PTK or any other graphic engine). I have been using picking matrix in OpenGL for my 3D applications, but now, as my needs do not exceed 2D sprites mouse handling, I'm looking for an easier way. Is color picking using rendering to offscreen a good/easy/fast way to handle mouse picking or is it considered as a workaround? Does it have any downsides? Regards, Marko
Advertisement
Color picking in my opinion is about the best you can do.

Even on the OpenGL site it says picking matrix is deprecated and any modern picking implementation should use color picking.

There's no real down side to color picking other than the fact you have to render objects again.

So in all as far as i'm aware color picking is the most accepted method around.
"color picking" ?
...iterate the object rectangles and see if the mouse is inside it?
Construct (Free open-source game creator)
@AshleysBrain

I should have been more specific.
Yes, that would be simple, but I was talking about mouse picking of non-rectangular shapes, for example, transparent pngs (like in any Hidden Object game).


@thedustbustr

Check out color picking in OpenGL.

This topic is closed to new replies.

Advertisement