(WIP) Bindings for OpenVR v2.2.3
Copy zopenvr
folder to a subdirectory of your project and add the following to your build.zig.zon
.dependencies:
.zopenvr = .{ .path = "path/to/local/zopenvr" },
Then in your build.zig
add:
pub fn build(b: *std.Build) !void {
const exe = b.addExecutable(.{ ... });
const zopenvr = b.dependency("zopenvr", .{});
const zopenvr_path = zopenvr.path("").getPath(b);
exe.root_module.addImport("zopenvr", zopenvr.module("zopenvr"));
try @import("zopenvr").addLibraryPathsTo(exe, zopenvr_path);
@import("zopenvr").linkOpenvr(exe);
try @import("zopenvr").installOpenvr(&exe.step, options.target.result, .bin, zopenvr_path);
}
Now in your code you may import and use zopenvr
:
const std = @import("std");
const OpenVR = @import("zopenvr");
pub fn main() !void {
...
const openvr = try OpenVR.init(.scene);
defer openvr.deinit();
const system = try openvr.system();
const name = try app.system.allocTrackedDevicePropertyString(allocator, OpenVR.hmd, .tracking_system_name);
defer allocator.free(name);
...
}
Interface | Status |
---|---|
Applications | ✅ |
BlockQueue | |
Chaperone | ✅ |
ChaperoneSetup | |
Compositor | ✅ (d3d12 only) |
Debug | |
DriverManager | |
ExtendedDisplay | |
HeadsetView | |
Input | ✅ |
IOBuffer | |
Notifications | |
Overlay | |
OverlayView | |
Paths | |
Properties | |
RenderModels | ✅ |
Resources | |
Screenshots | |
Settings | |
SpatialAnchors | |
System | ✅ |
TrackedCamera |