Sign in to follow this  

Any way to draw a line in DirectDraw?

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

This topic is 4747 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this