ravi.joshi53's picture

How to display GameWindow in Projector Screen

Hi,
In one of my C# application, I have two windows. The first window should be displayed on primary screen whereas the second window should be displayed in projector screen.
The first window is a window form, which can be displayed easily in primary screen but how to display the second window (which is a instance of GameWindow class) in projector screen?

Please help.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Use the GameWindow constructor that takes an explicit DisplayDevice parameter:

            var projector =
                DisplayDevice.GetDisplay(DisplayIndex.Second) ??
                DisplayDevice.GetDisplay(DisplayIndex.Default); // in case the projector is not connected
 
            var gw2 = new GameWindow(
                projector.Width,
                projector.Height,
                GraphicsMode.Default,
                "My Window",
                GameWindowFlags.Fullscreen,
                projector);

Edit: updated with some more robust code to create a fullscreen window on the projector display.

ravi.joshi53's picture

Thanks a lot Fiddler, It works perfectly and quite simple as well.

flopoloco's picture

This ?? operator rocks. Didn't know it. :)
http://msdn.microsoft.com/en-us/library/ms173224.aspx

ravi.joshi53's picture

Yeah... see the beauty of null-coalescing operator.