GameViewportClient中有个变量控制是否显示硬件鼠标:

var transient bool bDisplayHardwareMouseCursor

也就是系统的光标,一般通过该类中的函数来操纵:

simulated event SetHardwareMouseCursorVisibility(bool bIsVisible)
{
local Vector2D ViewportSize; //If we are going to be turning on the hardware cursor when it was not already on, we will move the cursor to the middle of the screen
if (bIsVisible && !bDisplayHardwareMouseCursor)
{
GetViewportSize(ViewportSize);
SetMouse(ViewportSize.X/,ViewportSize.Y/);
}
bDisplayHardwareMouseCursor = bIsVisible; ForceUpdateMouseCursor(TRUE);
}

其中ForceUpdateMouseCursor是native函数,调用到UGameViewportClient::ForceUpdateMouseCursor,

在Windows上的实现类为FWindowsViewport,其成员函数

void FWindowsViewport::UpdateMouseLock( UBOOL bEnforceMouseLockRequestedFlag )

在每个tick中被调用,会对该控制变量进行检测:

    RECT ClipRect;
UBOOL bIsHardwareCursorVisible = (GEngine && GEngine->GameViewport && GEngine->GameViewport->bDisplayHardwareMouseCursor);
UBOOL bIsAnyCursorVisible = bIsSystemCursorVisible || bIsHardwareCursorVisible;
UBOOL bClipRectValid = (::GetClipCursor( &ClipRect ) != );
UBOOL bHasFocus = HasFocus();
UBOOL bShouldMouseLock = bEnforceMouseLockRequestedFlag ? bMouseLockRequested : bHasFocus && (IsFullscreen() || !bIsAnyCursorVisible || bMouseLockRequested);

最后在bShouldMouseLock为TRUE时,调用::ClipCursor锁定鼠标。

unreal3窗口锁定鼠标开关的更多相关文章

  1. Qt 隐藏标题栏 窗口移动 鼠标事件

    摘要 隐藏标题栏 头文件声明鼠标移动虚函数 .cpp文件实现功能 1 setWindowFlags(Qt::FramelessWindowHint | windowFlags()); 无标题栏移动窗体 ...

  2. Qt窗口添加鼠标移动拖拽事件

    1. .h文件中添加 private:    QPoint dragPosition; 2. 在cpp文件中重写鼠标点击和拖拽函数 void ShapeWidget::mousePressEvent( ...

  3. VC++ SetLayeredWindowAttributes 部分窗口透明鼠标穿透

    在初始化中使用下面两行代码 ModifyStyleEx(0, WS_EX_LAYERED); ::SetLayeredWindowAttributes(m_hWnd, RGB(1, 255, 0), ...

  4. unity中锁定鼠标移动&&隐藏鼠标&&强制是鼠标移动到某一位置

    [System.Runtime.InteropServices.DllImport("user32.dll")] //引入dll public static extern int ...

  5. 【windows】窗口锁定状态如何关机

    在锁定界面下方有一个——切换用户,点击,过一会右下角就有一个红色的圆圈,就可以关机了.

  6. Delphi锁定鼠标 模拟左右键 静止一会自动隐藏鼠标

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  7. qt 自定义窗口显示鼠标划过的轨迹

    鼠标事件分为四种: 1.按下 2.抬起 3.移动 4.双击 鼠标事件继承与QWidget void mouseDoubleClickEvent(QMouseEvent *event) void mou ...

  8. wxpython 简单例子:显示文本框的窗口显示鼠标位置

    简单例子来自教程: #!/bin/env python import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__ ...

  9. .Net鼠标随动窗口

    就像QQ宠物或者迅雷悬浮窗口一样,鼠标点下去窗体跟着鼠标动 主要是两个时间的加载 MouseDown和MouseMove事件 MouseDown事件: private int _StartX ;//鼠 ...

随机推荐

  1. DEV开发之界面皮肤

    最终效果:正文本人的环境是 VS2013+DEV 13.21.第一步,新建项目,(忽略)???2.修改Form1.cs的基类,Form修改为DevExpress.XtraBars.Ribbon.Rib ...

  2. OSI模型网络分层

    OSI TCP/IP --- ------- 应用层 表示层 应用层 会话层 ----- ------- 传输层 TCP UDP ----- ------- 网络层 IPv4/IPv6 ----- - ...

  3. Windows Server 2008无损调整分区的方法

    今天在装windows2008服务器的时候  发现系统只有C盘  该如何对C盘进行分区呢   windows2007 可以直接格式化  在windows2008服务器中格式化是灰色的  不能用  寻求 ...

  4. Android系统篇之—-编写简单的驱动程序并且将其编译到内核源码中【转】

    本文转载自:大神 通过之前的一篇文章,我们了解了 Android中的Binder机制和远程服务调用 在这篇文章中主要介绍了Android中的应用在调用一些系统服务的时候的原理,那么接下来就继续来介绍一 ...

  5. case 练习

    #!/bin/bash RED_COLOR="\E[1;31m" GREEN_COLOR="\E[1;32m" YELLOW_COLOR="\E[1; ...

  6. 英语发音规则---字母组合oo的发音规律

    英语发音规则---字母组合oo的发音规律 一.总结 一句话总结:在英语单词中,字母组合oo多数读长音/u:/,少数读短音/ʊ/.另外,还有极少数的特殊情况读/ʌ/, 在英语单词中,字母组合oo多数读长 ...

  7. the referenced script on this behaviour is missing!

    1.看看你脚本上挂的某个组件是不是发生了变动,比如被删除了什么的 2.最有可能的是你创建完脚本后,中途改过脚本的名字,致使脚本名字和内部的名字不统一.

  8. CCUserDefault 存档

    void HelloWorld::testCCUserDefault() { CCSize size = CCDirector::sharedDirector()->getWinSize(); ...

  9. BZOJ4976: [Lydsy1708月赛]宝石镶嵌

    BZOJ4976: [Lydsy1708月赛]宝石镶嵌 https://lydsy.com/JudgeOnline/problem.php?id=4976 分析: 本来是从\(k\le 100\)这里 ...

  10. Android App在Google App Store中搜不到

    情景:Android App在Google App Store上架成功,三星手机可以在Google App Store中搜索到,但是三星tablet却无法在Google App Store中搜索到,目 ...