Jump to content
  • Advertisement
Sign in to follow this  
G_Axer

Fullscreen

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

Hi, I know this must be really simple but my attemptions to make my program fullscreen with resolution 800x600 failed. I'm programing in C# in Direct3D and I want to create my very first big game. So please - I'm using this code to initialize drawing but it only makes canvas in a window..
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
    
presentParams.SwapEffect = SwapEffect.Copy;
presentParams.PresentationInterval = PresentInterval.One;

dGDevice = new DGDevice(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, m_TargetForm, CreateFlags.SoftwareVertexProcessing, presentParams);

dGDevice.RenderState.ReferenceAlpha = 0;
dGDevice.RenderState.AlphaFunction = Compare.NotEqual;
    
DXSprite = new D3DSprite(Device);

Thx very much for your advices....

Share this post


Link to post
Share on other sites
Advertisement
I hope I am understanding this correctly.
You want to make your game/engine/application or program fullscreen.
This means you will have to change the PresentParameters's Windowed property to false.

Some sample code to provide you with some reference to work from

//Setup the Present Parameters.
PresentParameters pparams = new PresentParameters();
pparams.BackBufferCount = 1;
pparams.BackBufferFormat = Format.X8R8G8B8;
pparams.BackBufferWidth = control.Width;
pparams.BackBufferHeight = control.Height;
//Enable the auto depth stencil format and set the format to 24bits for the depth buffer and 8 bits for the stencil buffer
pparams.EnableAutoDepthStencil = true;
pparams.AutoDepthStencilFormat = DepthFormat.D24S8;
pparams.SwapEffect = SwapEffect.Discard;
if (windowed)
{
pparams.Windowed = true;
}
else
{
pparams.Windowed = false;
pparams.PresentationInterval = PresentInterval.One;
}
try
{
device = new Device(0, DeviceType.Hardware, control.Handle, createFlags, pparams);
}
catch (DirectXException ex)
{
MessageBox.Show(ex.ErrorString);
}



This is no where near a decent way to instantiate the device as there are no checks wether the device supports some of the variables but it should show you how to setup your present parameters.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Also note that the value of refresh rate in PresentParameters must be 0 for windowed, and a valid supported value for fullscreen.

Share this post


Link to post
Share on other sites
It would be in your best interest to check out some good basic tutorials. They will help you get going much quicker and with fewer mistakes. The Forum FAQ has a list of tutorial sites that can help you out.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!