예제 #1
0
        public bool SendNotification(string text, string bitmapKey = null, int displayForMs = 2000)
        {
            NotificationBitmap_t bmp = new NotificationBitmap_t();

            if (bitmapKey != null)
            {
                if (!_icons.ContainsKey(bitmapKey))
                {
                    throw new Exception("Invalid Bitmap Key");
                }

                bmp.m_nBytesPerPixel = 4;
                bmp.m_nHeight        = _icons[bitmapKey].Bitmap.Height;
                bmp.m_nWidth         = _icons[bitmapKey].Bitmap.Width;
                bmp.m_pImageData     = (IntPtr)(_icons[bitmapKey].glTextureId);
            }

            uint notId = 0;
            EVRNotificationError err = EVRNotificationError.OK;

            err = OpenVR.Notifications.CreateNotification(_overlay.Handle, 0, EVRNotificationType.Transient, text, EVRNotificationStyle.Application, ref bmp, ref notId);

            if (err != EVRNotificationError.OK)
            {
                SteamVR_WebKit.Log("Notification Failure: " + err.ToString());
                return(false);
            }
            return(true);
        }
예제 #2
0
            public string GetPropertyString(EVRApplicationProperty prop)
            {
                EVRApplicationError err            = EVRApplicationError.None;
                StringBuilder       propertyBuffer = new StringBuilder(255);

                OpenVR.Applications.GetApplicationPropertyString(AppKey, prop, propertyBuffer, 255, ref err);

#if DEBUG
                if (err != EVRApplicationError.None)
                {
                    SteamVR_WebKit.Log("EVRApplicationError on " + AppKey + " property " + prop.ToString() + ": " + err.ToString());
                }
#endif

                //SteamVR_WebKit.Log(propertyBuffer.ToString());

                return(propertyBuffer.ToString());
            }