
Mouse Matters...
Hi,
I have been working on a Isometric engine the past few days and now I am working with the mouse crap. I read the tutorial "Mosue Matters" and it all makes sense. My only question is, how would I go about determining the color of a pixel from a DirectDraw7 Surface?
Thanks...
P.S. Using Directx 7, might of guessed that, and VC++.

well, you''ve got several choices.
you can use Lock/Unlock and read in the pixel yourself
or
you can use GetDC/ReleaseDC and use GetPixel for the GDI method.
in either case...
when you scan a mousemap, be sure to put it into an array (you dont want to be locking surfaces everytime you want to look up a point).
you can use Lock/Unlock and read in the pixel yourself
or
you can use GetDC/ReleaseDC and use GetPixel for the GDI method.
in either case...
when you scan a mousemap, be sure to put it into an array (you dont want to be locking surfaces everytime you want to look up a point).
Get off my lawn!
The way i normally do it is i first get the colors from the four corners of the image (since they are all different, they will have different values). i store this in temporary variables. i then scan the image, and i check against each of these stored values, giving (for example) a 1 for the upper left, 2 for the upper right, etc.
If there is no match with any of the temporary variables, i put a special value that means "center of tile".
For more information on how i work mousemaps, I do have the IsoHexCore engine (the engine from my book) source on isohex.net.
If there is no match with any of the temporary variables, i put a special value that means "center of tile".
For more information on how i work mousemaps, I do have the IsoHexCore engine (the engine from my book) source on isohex.net.
Get off my lawn!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement