ShowMouse() public static method

IN_ShowMouse
public static ShowMouse ( ) : void
return void
Exemplo n.º 1
0
        /// <summary>
        /// GL_EndRendering
        /// </summary>
        public static void EndRendering()
        {
            MainForm form = MainForm.Instance;

            if (form == null)
            {
                return;
            }

            if (!SkipUpdate || BlockDrawing)
            {
                form.SwapBuffers();
            }

            // handle the mouse state
            if (!Vid.WindowedMouse)
            {
                if (_IsMouseWindowed)
                {
                    Input.DeactivateMouse();
                    Input.ShowMouse();
                    _IsMouseWindowed = false;
                }
            }
            else
            {
                _IsMouseWindowed = true;
                if (Key.Destination == keydest_t.key_game && !Input.IsMouseActive &&
                    Client.cls.state != cactive_t.ca_disconnected) // && ActiveApp)
                {
                    Input.ActivateMouse();
                    Input.HideMouse();
                }
                else if (Input.IsMouseActive && Key.Destination != keydest_t.key_game)
                {
                    Input.DeactivateMouse();
                    Input.ShowMouse();
                }
            }

            if (FullSbarDraw)
            {
                Sbar.Changed();
            }
        }
Exemplo n.º 2
0
        // VID_SetMode (int modenum, unsigned char *palette)
        // sets the mode; only used by the Quake engine for resetting to mode 0 (the
        // base mode) on memory allocation failures
        public static void SetMode(int modenum, byte[] palette)
        {
            if (modenum < 0 || modenum >= _Modes.Length)
            {
                Sys.Error("Bad video mode\n");
            }

            mode_t mode = _Modes[modenum];

            // so Con_Printfs don't mess us up by forcing vid and snd updates
            bool temp = Scr.IsDisabledForLoading;

            Scr.IsDisabledForLoading = true;

            CDAudio.Pause();

            // Set either the fullscreen or windowed mode
            DisplayDevice dev  = MainForm.DisplayDevice;
            MainForm      form = MainForm.Instance;

            if (_Windowed)
            {
                form.WindowState  = WindowState.Normal;
                form.WindowBorder = WindowBorder.Fixed;
                form.Location     = new Point((mode.width - form.Width) / 2, (mode.height - form.Height) / 2);
                if (_WindowedMouse.Value != 0 && Key.Destination == keydest_t.key_game)
                {
                    Input.ActivateMouse();
                    Input.HideMouse();
                }
                else
                {
                    Input.DeactivateMouse();
                    Input.ShowMouse();
                }
            }
            else
            {
                try
                {
                    dev.ChangeResolution(mode.width, mode.height, mode.bpp, mode.refreshRate);
                }
                catch (Exception ex)
                {
                    Sys.Error("Couldn't set video mode: " + ex.Message);
                }
                form.WindowState  = WindowState.Fullscreen;
                form.WindowBorder = WindowBorder.Hidden;
            }

            viddef_t vid = Scr.vid;

            if (vid.conheight > dev.Height)
            {
                vid.conheight = dev.Height;
            }
            if (vid.conwidth > dev.Width)
            {
                vid.conwidth = dev.Width;
            }

            vid.width  = vid.conwidth;
            vid.height = vid.conheight;

            vid.numpages = 2;

            CDAudio.Resume();
            Scr.IsDisabledForLoading = temp;

            _ModeNum = modenum;
            Cvar.Set("vid_mode", (float)_ModeNum);

            // fix the leftover Alt from any Alt-Tab or the like that switched us away
            ClearAllStates();

            Con.SafePrint("Video mode {0} initialized.\n", GetModeDescription(_ModeNum));

            SetPalette(palette);

            vid.recalc_refdef = true;
        }