Plugin developers, Beta 5 includes a few new VR-specific APIs in the XPLMDisplay header.
The complete list of VR-specific APIs is now:
- XPLMGetWindowGeometryVR()
- XPLMSetWindowGeometryVR()
- XPLMWindowIsInVR()
- A two-step process for allowing widget-based plugins to go to VR:
- Opt-in to the “modern” window APIs:
XPLMEnableFeature("XPLM_USE_NATIVE_WIDGET_WINDOWS", 1)
- Use XPGetWidgetUnderlyingWindow() get an XPLMWindowID to pass to the XPLMDisplay APIs
- Opt-in to the “modern” window APIs:
- A new positioning mode to pass to XPLMSetWindowPositioningMode(): xplm_WindowVR
- Two new messages sent to your XPluginReceiveMessage() callback, useful for knowing when to move your window in and out of VR:
- XPLM_MSG_ENTERED_VR
- XPLM_MSG_EXITING_VR—Note that when moving back to the 2-D monitor, you’ll also want to reposition the window—if you just change your positioning mode, the window will be offscreen.
I’ve updated the VR sample plugin to take advantage of all the new stuff here, minus the widget API—really, once you enable native widget windows, your widget window becomes “just another XPLM window” as far as the display APIs are concerned.
Hi Tyler,
Thankyou for the updated docs as it helped me update Xchecklist that now resizes in VR just like it did in 2d.
Bill
Excellent! 🙂
Brilliant, Tyler!
Any chance the SDK could be formally published via Git/Github?
I have tried to get Xchecklist window into VR but not having any luck. I call this with a menu selection of open checklist.
void xcvr_create_gui_widget_window() {
XPGetWidgetUnderlyingWindow(xcvr_widget_window);
vr_is_enabled = XPLMGetDatai(g_vr_dref);
XPLMSetWindowIsVisible(xcvr_widget_window,1);
XPLMSetWindowPositioningMode(xcvr_widget_window, vr_is_enabled ? xplm_WindowVR : xplm_WindowPositionFree, -1);
}
Does this look like it should work or should I file a bug report?
Thanks Bill
XPGetWidgetUnderlyingWindow() returns the XPLMWindowID you need to pass to all the window manipulation APIs—passing a widget ID won’t do it.
You want something like this:
Thankyou that got it working and will be doing further testing and let you know how it goes.
Here is my report and have the Xchecklist widget working with one issue remaining but think I know the issue,
When we use the “Next” or “Previous” buttons to get another checklist page we use destroy widget and then create a new widget with the new info for the updated checklist page.
The result of that is the updated checklist is attached to your headset so wondered if there was a way to remember where it was and put the updated checklist there? That is what I was doing with the X-Plane 11 new GUI windows but they are solid and the widget Xchecklist is translucent which is what I am looking for.
Thanks Bill
No… there’s no support currently for positioning a newly created window anywhere but attached to the HMD. Your best bet is to simply reconfigure the widget window that existed previously (rather than creating a new one).