Archived

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

langguy

DX9 Fullscreen

Recommended Posts

langguy    122
I can''t seem to get fullscreen up and running for Direct3D in C#. Here is my code for initializing for windowed mode:
public Direct3DHandler(ref Device dev, Control RenderTarget, 
                   bool bWindowed, int nWidth, int nHeight,
                   int nColorDepth)
	{
        try
        {//try to initalize D3D

		PresentParameters pres = new PresentParameters();
		pres.Windowed = bWindowed;
		if(bWindowed)
			pres.SwapEffect = SwapEffect.Discard;
		else
		{
		       //do fullscreen stuff

		}

		pres.EnableAutoDepthStencil = true;
		pres.AutoDepthStencilFormat  = DepthFormat.D16;

		dev = new Device(0, DeviceType.Hardware, RenderTarget, CreateFlags.SoftwareVertexProcessing, pres);
	}
	catch(Exception e)
        {
                MessageBox.Show("Error initializing Direct3D: " + e.Message);
        }
}
What do I replace the "//do fullscreen stuff" with to make it full screen rather than windowed? Sorry if this has been answered before, but I can''t seem to find anything specific to C#.

Share this post


Link to post
Share on other sites
langguy    122
Thanks! That worked (after messing with the color depth a few times [not all of them work]).This is my modified code:


PresentParameters pres = new PresentParameters();
pres.Windowed = bWindowed;
if(bWindowed)
pres.SwapEffect = SwapEffect.Discard;
else
{
pres.SwapEffect = SwapEffect.Flip;
pres.BackBufferCount = 1;
pres.BackBufferWidth = nWidth;
pres.BackBufferHeight = nHeight;
pres.BackBufferFormat = Format.X8B8G8R8;
}

Share this post


Link to post
Share on other sites