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#.
DX9 Fullscreen
I can''t seem to get fullscreen up and running for Direct3D in C#. Here is my code for initializing for windowed mode:
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;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement