unreal3窗口锁定鼠标开关
2024-08-25 03:26:53
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锁定鼠标。
最新文章
- 微型orm fluentdata
- 黄聪:wordpress/wp-includes目录文件
- ORACLE-树状数据结构获取各层级节点信息
- [DEncrypt] HashEncode--哈希加密帮助类 (转载)
- 同步的HTTP请求
- MPMoviePlayerController 电影播放器—备用
- 读书时间《JavaScript高级程序设计》六:事件
- 数据访问层的改进以及测试DOM的发布
- MYsql优化where子句
- Java中equal和==区别及String创建过程
- Head First Java设计模式思维导图总结
- Laravel5中通过SimpleQrCode扩展包生成二维码实例
- python实战学习之matplotlib绘图
- Java类的加载时机
- php 处理上百万条的数据库如何提高处理查询速度
- maven 引用另一个jar包 需要先打包在仓库里面 并在pom里面配置 才可以引用
- ES系列七、ES-倒排索引详解
- Python day3_string的常见方法2_笔记
- LaTeX技巧:如何高效地将LaTeX代码转为Word公式
- WritePrivateProfileString GetPrivateProfileString 读取写 配置文件