X-Plane开始在3D模式(插件C/ c++)
X-Plane start in 3D mode (plugin C/C++)
我想在3D模式下开始X-Plane 10 (3D驾驶舱),所以我创建了这个插件,但它不起作用。怎么了?我已经检查了X-Plane日志,插件已经成功加载。
/* This X-Plane plugin will enable 3D cockpit when X-Plane is started */
#pragma warning(disable: 4996) // Suppress warnings about unsafe operations in VS
#include <string.h>
#include <windows.h>
#include "XPLMDataAccess.h" // Required to get access to X-Plane data references
#if IBM
// Required if plugin is running on Windows
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif
/* This method is a part of the X-Plane plugin architecture.
Will be executed when X-Plane loads the plugin. */
PLUGIN_API int XPluginStart(char* name, char* package, char* description)
{
// Describe our plugin to the X-Plane plugin system
strcpy(name, "Enable3D");
strcpy(package, "com.stackoverflow.enable3d");
strcpy(description, "Enable 3D cockpit when X-Plane starts");
// Contains the data reference file controlling the panel view
XPLMDataRef panelRenderType = XPLMFindDataRef("sim/graphics/view/panel_render_type");
// Set panel view to 3D cockpit
XPLMSetDatai(panelRenderType, 2);
// Initialization successful
return 1;
}
/* This method is a part of the X-Plane plugin architecture.
Will be executed when X-Plane closes the plugin. */
PLUGIN_API void XPluginStop(void)
{
// Do nothing
}
/* This method is a part of the X-Plane plugin architecture.
Will be executed when the user enables the plugin. */
PLUGIN_API int XPluginEnable(void)
{
// Enabled successfully
return 1;
}
/* This method is a part of the X-Plane plugin architecture.
Will be executed when the user disables the plugin. */
PLUGIN_API void XPluginDisable(void)
{
// Do nothing
}
/* This method is a part of the X-Plane plugin architecture.
The method acts as a message handler. We don't have to do
anything here, but we must provide one. */
PLUGIN_API void XPluginReceiveMessage(XPLMPluginID caller, long message, void* param)
{
// Do nothing
}
根据文档,"sim/graphics/view/panel_render_type"数据引用应该为2D-panel设置为1,3D-panel设置为2,lit 3D-panel设置为3。
并非X-Plane中的所有内容都是通过Datarefs访问的。
你可以从Plugin SDK进入按键/操纵杆-按钮分配系统。
试试这个片段:
XPLMCommandOnce( XPLMFindCommand( "sim/view/3d_cockpit_cmd_look" ) );
与"延迟初始化"代码结合:
http://www.xsquawkbox.net/xpsdk/mediawiki/DeferredInitialization示例当组合时,你应该有一个插件,将启用3d座舱模式
有点晚了,但是DataRefs表表明sim/graphics/view/panel_render_type
是不可写的。
在这一点上我没有一个很好的解决办法:/
相关文章:
- 从C++本机插件更新Vector3数组
- 使用CMake创建QML插件
- 停止cmake target_link_libraries将插件中静态库的两个对象文件链接到静态库本身
- 如何创建从Maya(或类似程序)到虚幻引擎的自定义数据导出插件
- clang 插件:在编译过程中修改 AST
- 实现动态插件管理器
- 我想通过带有C++和Python的插件创建一个可扩展的应用程序
- Agora.io 虚幻引擎插件构建错误
- 使用带有C++对象和标准库容器的插件系统
- 运行命令 "rosbag play example.bag" 时出错。找不到与插件 rosbag/NoEncryptor 对应的库
- 编译 llvm 插件时出现问题:llvm/Config/llvm-config.h:没有这样的文件或目录
- 通过 Gazebo 世界插件将静态对象附加到机器人链接
- 如何为模块化应用程序实现C++插件系统
- 'string'文件在带有C++文件的iOS插件上找不到
- 在 Android 上安装 GStreamer 插件
- 如何使用MSVC 2019创建和使用Qt 5.14.0自定义小工具插件
- 如何在 Windows 操作系统中在 geany 中安装插件
- 节点插件 API 将数组作为函数参数传递
- OpenVINO - 推理库插件 libMKLDNNPlugin.so 无法解析依赖关系
- 通过 Flutter 从C++插件访问资产