Terrain/Unit Selection
OK now, i understand to select units in isometric games you will need to color-code things to tell what you are selecting. What I need to know is how to read in a color from a surface. IE what I want to do is print out an extra surface in memory only that consists of say blue green and red, and depending on what color it is i will know what has been selected. I need to know how to interpret what color a pixel is on that surface by giving a function 2 coords (x,y). Thanks if anyone knows, i''m using 32 bit color in directx.
Mike
Look up the directX documentation for lock(). This will give you a surface pointer and pitch value. Together with the pixel format (which you should already know from setting the graphics mode, or also get through the lock call), that''s all you need.
Be careful though:
1) pitch is not generally the same as the surface width
2) locking videomemory surfaces may be expensive performance wise and might not even work at all on some driver/card combinations (or some surfaces, IIRC you cannot lock a D3D z-buffer for example)
BuschnicK
Life would be much easier if I had the source code.
blackfish.sourceforge.net
Be careful though:
1) pitch is not generally the same as the surface width
2) locking videomemory surfaces may be expensive performance wise and might not even work at all on some driver/card combinations (or some surfaces, IIRC you cannot lock a D3D z-buffer for example)
BuschnicK
Life would be much easier if I had the source code.
blackfish.sourceforge.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement