C# + Some directdraw questions

Recommended Posts

Hi all, I am developing a graphics engine using DirectDraw and C#. It is working very nice, but I have a few questions: 1) I have a big island with some bugs. I want them to rotate. How can I rotate a bitmap surface? 2) My graphics engine is able to resize and draw everything in the right size. However, when I am using large images which are getting very small, it looks very ugly. (wrong, as it should be). Is there anything I can do about this? Thanks!

Share on other sites
Quote:
 Original post by Tischnoetentoet1) I have a big island with some bugs. I want them to rotate. How can I rotate a bitmap surface?

In DirectDraw, you can't. You have to rotate a virtual quad, and write a texture mapper that locks the target surface and maps the bmp into it. Basically, a mini -software-rasterizer.

Quote:
 2) My graphics engine is able to resize and draw everything in the right size. However, when I am using large images which are getting very small, it looks very ugly. (wrong, as it should be). Is there anything I can do about this?

Make the original bitmap small in size. In general, a 2D asset should have a size the same as or near to the one it has in game.

Share on other sites
Hello,

Thanks for the reply! Too bad that option 1) is not possible in directdraw.

I have one question left. I am using this code

			// Create our destination rectangle			pntTarget = m_oRenderTarget.PointToScreen(m_oRenderTarget.Location);			oDestRect = new Rectangle(pntTarget, m_oRenderTarget.Size);			// Try to draw			try			{				m_oSurfacePrimary.Draw(oDestRect, m_oSurfaceSecondary, DrawFlags.DoNotWait);			}			catch (SurfaceLostException)			{				// Create the surfaces				CreateSurfaces();			}

The strange thing is that the destrect function is failing. When I don't use the destrect, everything works, but when using destrect, the surface is not drawn in the rectangle I want it to be.

Any idea what I am doing wrong?

[Edited by - Muhammad Haggag on November 12, 2005 10:09:42 PM]