Ejemplo n.º 1
0
    public static void Init(EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene)
    {
        EVRInitError peError = EVRInitError.None;

        OpenVR.Init(ref peError, eApplicationType);
        if (peError != EVRInitError.None)
        {
            throw OpenVRException.Make(peError);
        }
    }
Ejemplo n.º 2
0
    public static int GetInt32TrackedDeviceProperty(this CVRSystem system, uint unDeviceIndex, ETrackedDeviceProperty prop)
    {
        ETrackedPropertyError error = ETrackedPropertyError.TrackedProp_Success;
        int value = system.GetInt32TrackedDeviceProperty(unDeviceIndex, prop, ref error);

        if (error != ETrackedPropertyError.TrackedProp_Success)
        {
            throw OpenVRException.Make(error);
        }
        return(value);
    }
Ejemplo n.º 3
0
    public static string GetStringTrackedDeviceProperty(this CVRSystem system, uint unDeviceIndex, ETrackedDeviceProperty prop)
    {
        ETrackedPropertyError error = ETrackedPropertyError.TrackedProp_Success;

        uint length = system.GetStringTrackedDeviceProperty(unDeviceIndex, prop, null, 0, ref error);

        StringBuilder builder = new StringBuilder((int)length);

        system.GetStringTrackedDeviceProperty(unDeviceIndex, prop, builder, length, ref error);
        if (error != ETrackedPropertyError.TrackedProp_Success)
        {
            throw OpenVRException.Make(error);
        }

        return(builder.ToString());
    }