Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RangerOne

WOrld map pixels?

This topic is 6932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!