WOrld map pixels?
Does anyone know a fast way to plot pixels in DirectDraw?
I was using the standard GetDC from the DirectDraw surface, to get the HDC so I can use PlotPixel function in GDI, because I need to plot a small image of the entire world map. (Think CivII)
I have Blt''s for drawing tiles in the TileArea map, but I need to plot individual pictures... I let the user choose between the terrain type view and a country view (with different colors for different countries), and then I plot pixel by pixel the image of the whole world.
Thanks in advance!
You can get a pointer to a surface by calling its Lock method and specifying one of the flags called SURFACE_POINTER or something (i forget the exact name). Then in the returned DDSURFACEDESC2 structure, use the .lpSurface element - once you have that, you can modify the surface memory directly... Just make SURE to Unlock the surface before trying to Blit or anything again
David
David
-- black eyez
dgoodlad@junction.net
dgoodlad@junction.net
or, you can actually use Blt to put the pixels.
of course, that would be wasteful.
here''s something you might want to do instead...
yes, use GetDC and SetPixelV to put together your initial map. Do this just ONCE.
now, you also should maintain an image that keeps track of each players exploration. make white be the area explored, and black the area unexplored.
next, when you are going to show your minimap, first copy the whole map, then copy the exploration map, using white as the color key. the result should be what you are looking for.
of course, that would be wasteful.
here''s something you might want to do instead...
yes, use GetDC and SetPixelV to put together your initial map. Do this just ONCE.
now, you also should maintain an image that keeps track of each players exploration. make white be the area explored, and black the area unexplored.
next, when you are going to show your minimap, first copy the whole map, then copy the exploration map, using white as the color key. the result should be what you are looking for.
Get off my lawn!
Good idea... I think what I WILL do is similar... I will maintain a separate surface for the world map area.. instead of PlotPixel to the Back surface. Then I will Blit the WorldArea surface to the Back surface, along with the TileArea surface and UnitStackArea surface, which is going at about 10 frames per second.
The only difference is that I will no longer update the WorldArea with PlotPixels, except when an event occurs that affects it, like exploration or building a city (which can change boundaries of a country.)
The only difference is that I will no longer update the WorldArea with PlotPixels, except when an event occurs that affects it, like exploration or building a city (which can change boundaries of a country.)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement