Jump to content
  • Advertisement
Sign in to follow this  
MLane

Any way to draw a line in DirectDraw?

This topic is 5052 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

I'm making a pocket tanks type game, and I'm working on drawing the cannon. I'm using the math for a circle around the center point of the tank, and I can find the coordinates for the end of the cannon. However, I'm trying to draw a line between the two points. I know this can easily be done in Visual Basic, and I was curious if there's a similar function in C++. If not, any solutions?

Share this post


Link to post
Share on other sites
Advertisement
DirectDraw basically doesn't do anything except blt. If your line is a static shape you might be able to store it in an off-screen surface and blt it over. For anything dynamic you need to do it yourself.

You can either call Lock on the surface and calculate the line yourself (google for "bresenham") or you can call GetDC and have GDI do the grunt work (e.g. using MoveToEx/LineTo).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!