|
-
Oct 22nd, 2001, 01:29 AM
#1
Thread Starter
Lively Member
-
Oct 22nd, 2001, 02:38 AM
#2
Fanatic Member
Well, a "simple" solution would be to create another invisible picture where you draw the outlines (masks, whatever) in different colors for each object in the same order you draw them on the visible picture. You can then simply determine what object you clicked by checking the pixel color at that location...
Don't have a clue on how to draw the masks in different colors though (at least not a fast way)...
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Oct 22nd, 2001, 05:54 AM
#3
Assign a RECT type to each image you Blt. Then, when the user clicks, find out if the user clicked inside one of the RECTs (inside one of the pictures), and if, so, find the offset from the top-left coordinates of the RECT. When you find those, use GetPixel() on the MASK image, and if the is the color of the mask(the doughnut part of it, it may be black or white, depending on the method you are using for Bltting), you hit the object.
Z.
-
Oct 22nd, 2001, 05:58 AM
#4
Fanatic Member
Mhh.....sounds like a good idea, but what if two objects overlap and the point is in two rectangles at the same time?
Mhhhh, my brain just started , you can just create a new type which holds not only the coordinates, but also the Z-index, so you can compare both when you find a point in two objects at the same time...
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Oct 22nd, 2001, 06:59 AM
#5
Thread Starter
Lively Member
-
Oct 22nd, 2001, 07:41 AM
#6
Thread Starter
Lively Member
alright.. I just learn how to use getpixel, still figuring out how to use the method u 2 mention above, will be appreciate if i can get some example thankx
-
Oct 22nd, 2001, 07:44 AM
#7
Or, instead of having a ZOrder, you could do a GetPixel on the final screen image, and test that against each of the original images (not the masks) to see which it belongs to. Then check the cooresponding mask.
dimsum, check out the PtInRect API. A RECT just stores the left, right, top and bottom coordinates of an area.
Z.
-
Oct 22nd, 2001, 08:02 AM
#8
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|