Forums

[Tips] Screen Resolution and Full Screen for MonoGame
Last Post 29 Nov 2015 09:01 PM by UkrEngine. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
UkrEngineUser is Offline
New Member
New Member
Posts:5


--
29 Nov 2015 09:01 PM
    Hi guys. After reading the forum, I decided to write a quick note about the "Screen Resolution and Full screen".
    As all of you know MonoGame - is a cross-platform game engine. For the Windows Desktop app it supports two graphics rendering - OpenGL (using OpenTK lib) and DirectX (using SharpDX lib). And for each of them has its own features in the work.

    1. Full Screen
    To enable the Full Screen for OpenGL render your need:
    e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen = true;

    To enable the Full Screen for DirectX render your need:
    graphics.IsFullScreen = true;

    2. Screen Resolution
    In order to properly handle the mouse position and the position of the controls on the screen you must specify the Height and Width for MonoGameEngine identical Height and Width for PreferredBackBuffer.
    Otherwise, processing will be incorrect. Example below:
    private int nativeScreenWidth;
    private int nativeScreenHeight;
    
    public MainGame()
    {
    	graphics = new GraphicsDeviceManager(this);
    	Content.RootDirectory = "Content";
    
    	graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings;
    	graphics.DeviceCreated += graphics_DeviceCreated;
    }
    
    private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
    {
    	nativeScreenWidth = 1920;
    	nativeScreenHeight = 1080;
    
    	graphics.PreferredBackBufferWidth = 1920;
    	graphics.PreferredBackBufferHeight = 1080;
                
    	// Other settings
    }
    
    private void graphics_DeviceCreated(object sender, EventArgs e)
    {
    	Engine engine = new MonoGameEngine(GraphicsDevice, nativeScreenWidth, nativeScreenHeight);
    } 
    


    3. All this is easy, but what happens if you specify a Screen Resolution smaller (or bigger) than you have is Windows and enable Full screen for your game?

    3.1. Game ScreenResolution is 2048x1152(common display resolutions for 16:9), Windows ScreenResolution is 1920х1080.
    As you can see visually all remains at level 1920х1080, but incorrect mouse position for both renderers

    3.2. Game ScreenResolution is 1800x960 (this is not-common display resolutions), Windows ScreenResolution is 1920х1080.
    The result is similar to the 1, but the quality of text rendering on DirectX just disgusting!

    3.3. Game ScreenResolution is 1600x900 (common display resolutions for 16:9), Windows ScreenResolution is 1920х1080.
    All the controls and the font will be increased, and mouse position for both renderers will be correct, but the quality of text rendering on DirectX still disgusting!

    3.4. Game ScreenResolution is 1024x768 (common display resolutions for 4:3), Windows ScreenResolution is 1920х1080.
    In this way if we are using DirectX rendering our controls and text will be stretched for screen, but mouse position will be incorrect (and quality of text rendering on very disgusting!)
    Other way if we are using OpenGL rendering our controls and text will be at center of the screen with black bar above.

    4. Some tips:
    - Use correct way to enable MonoGame full screen mode
    - Don't use not-common display resolutions in full screen mode
    - Use OpenGL render until the bugs fixed in DirectX

    P.S. Sorry for my English
    You are not authorized to post a reply.