XNA / C # game settings (menu?)

This is my first attempt to do something really interesting in C #, and I tried to create a simple form or game screen where the user could define a custom resolution / screen ratio, etc. or automatically detect the maximum screen size / ratio and output? this is my first game, so I was wondering if this is possible or there will be some serious problems with this, and not just install it on 1366x768 (resolution of all my computers). Thanks in advance for any help.

+3
source share
2 answers

You can list through the default GraphicAdapter property DisplayModeCollection to find a DisplayMode with a maximum width / height / aspect ratio.

Sort of:

GraphicsAdapter defaultAdapter = GraphicsAdapter.DefaultAdapter;
DisplayMode maxMode = defaultAdapter.DisplayModeCollection[0];
foreach (DisplayMode enumeratedDisplay in defaultAdapter.DisplayModeCollection)
{
    //Test enumeratedDisplay against maxMode, setting maxMode to enumeratedDisplay if enumeratedDisplay is better
}

Maybe there is a better way, but of course, one way to find the maximum size.

Or you can take the same DisplayModeCollection and fill out a comboBox sort or list, allowing the user to choose for themselves.

My apologies if the above code does not work in this exact form. I can’t check it where I am

+3
source

PreferredBackBuffer 1366x768, , . - . xbox , .

+1

Source: https://habr.com/ru/post/1738530/


All Articles