c# - 如何在 Linux 机器上访问 Mono 中的消息队列?
问题描述
我正在用 C# 和 Mono 编写游戏。我执行游戏循环并在窗口空闲时进行渲染(也就是说,当消息队列为空时)。我了解如何在 Windows 上执行此操作(使用 P/Invoke 从“User32.dll”导入 PeekMessage),但我不知道如何在 Linux 构建中获取有关消息队列状态的相同信息。我已经浏览了 Github 上的 Mono 存储库,它看起来不像直接访问消息队列被暴露。我正在运行的 Linux 版本是 Peppermint,如果有帮助的话。对此的任何指导将不胜感激。
bool WindowIsIdle()
{
#if Windows
NativeMessage result;
return PeekMessage(out result, IntPtr.Zero, 0, 0, 0) == 0;
#elif Linux
return false; //how can I get this information?
#endif
}
#if Windows
//Imports a native Win32 function for checking the windows message queue
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern int PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint remove);
struct NativeMessage
{
IntPtr Handle;
uint Message;
IntPtr WParameter;
IntPtr LParameter;
uint Time;
Point Location;
}
#endif
解决方案
推荐阅读
- google-apps-script - 使用 ImportJSON 将数据导入 Google 表格,根据列名选择值输出?
- java - Andorid App 没有自动识别位置
- javascript - 我可以对单个结果进行多个开玩笑测试吗?
- php - 性能提升 - Yii2 Eager loading
- flutter - 使用 pushReplacement 时等待孙子弹出
- php - Larave 条件聚合得到多个金额的总和
- python - OpenCV - 自适应阈值/有效降噪?
- javascript - JSON输入ajax意外结束
- linux - 安装适用于 Linux 的 Windows 子系统并收到错误 0xc03a001a 和长列表或问号
- xamarin.forms - 如何截取应用截图上传应用商店?