示例#1
0
        private void EnterFullScreen(PresentationParameters pp)
        {
            _switchingFullScreen = true;

            // store the location of the window so we can restore it later
            if (!IsFullScreen)
            {
                _locationBeforeFullScreen = Form.Location;
            }

            _platform.Game.GraphicsDevice.SetHardwareFullscreen();

            if (!pp.HardwareModeSwitch)
            {
                // FIXME: setting the WindowState to Maximized when the form is not shown will not update the ClientBounds
                // this causes the back buffer to be the wrong size when initializing in soft full screen
                // we show the form to bypass the issue
                Form.Show();
                IsBorderless     = true;
                Form.WindowState = FormWindowState.Maximized;
                _lastFormState   = FormWindowState.Maximized;
            }

            IsFullScreen       = true;
            HardwareModeSwitch = pp.HardwareModeSwitch;

            _switchingFullScreen = false;
        }
示例#2
0
        internal void RunLoop()
        {
            // https://bugzilla.novell.com/show_bug.cgi?id=487896
            // Since there's existing bug from implementation with mono WinForms since 09'
            // Application.Idle is not working as intended
            // So we're just going to emulate Application.Run just like Microsoft implementation
            Form.Show();

            var nativeMsg = new NativeMessage();

            while (Form != null && Form.IsDisposed == false)
            {
                if (PeekMessage(out nativeMsg, IntPtr.Zero, 0, 0, 0))
                {
                    Application.DoEvents();

                    if (nativeMsg.msg == WM_QUIT)
                    {
                        break;
                    }

                    continue;
                }
                UpdateWindows();
                Game.Tick();
            }

            // We need to remove the WM_QUIT message in the message
            // pump as it will keep us from restarting on this
            // same thread.
            //
            // This is critical for some NUnit runners which
            // typically will run all the tests on the same
            // process/thread.
            var msg = new NativeMessage();

            do
            {
                if (msg.msg == WM_QUIT)
                {
                    break;
                }

                Thread.Sleep(100);
            }while (PeekMessage(out msg, IntPtr.Zero, 0, 1 << 5, 1));
        }
 internal void Initialize(int width, int height)
 {
     _form.ClientSize = new Size(width, height);
     _form.Show();
 }