Terrain/Unit Selection

Started by
0 comments, last by ktuluorion 22 years, 3 months ago
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
[Piebert Entertainment] [Ask The All-Knowing Oracle A Question]------------------------------------------------------------GDSFUBY GameDev Society For UnBanning YodaTheCodaIf you want to see yoda unbanned then put this in your sig ------------------------------------------------------------DAIAGA Dave Astle is a God Association. To join, put this in your sig!Founder and High Priest of DAIAGA[edited by - YodaTheCoda on December 10, 2003 1:57:54 PM]
Advertisement
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
Life would be much easier if I had the source code.blackfish.sourceforge.net

This topic is closed to new replies.

Advertisement