Exemplo n.º 1
0
 public OpenVREventArgs(VREvent_t rawEvent)
 {
     EventType   = (EVREventType)rawEvent.eventType;
     DeviceIndex = (int)rawEvent.trackedDeviceIndex;
     Age         = rawEvent.eventAgeSeconds;
     EventData   = rawEvent.data;
 }
Exemplo n.º 2
0
        public override void OnVREvent_Scroll(VREvent_Data_t Data)
        {
            base.OnVREvent_Scroll(Data);

            if (CurrentBitmap != null)
            {
                float Delta = -Data.scroll.ydelta * (100 + (100 * (Data.scroll.repeatCount / 5)));
                if (Delta > 0)
                {
                    float maxScroll = CurrentBitmap.Height - CalmpHeight - CurrentHeight;
                    this.CurrentHeight += maxScroll > 0 ? Math.Min(maxScroll, Delta) : 0.0f;
                }
                else
                {
                    this.CurrentHeight = (this.CurrentHeight + Delta) >= 0 ? (this.CurrentHeight + Delta) : 0.0f;
                }
                RenderBitmap();
            }
        }
Exemplo n.º 3
0
 public virtual void OnVREvent_Scroll(VREvent_Data_t Data)
 {
 }
Exemplo n.º 4
0
 public virtual void OnVREvent_TouchPadMove(VREvent_Data_t Data)
 {
 }
Exemplo n.º 5
0
 public virtual void OnVREvent_ButtonUntouch(VREvent_Data_t Data)
 {
 }
Exemplo n.º 6
0
 public virtual void OnVREvent_ButtonUnpress(VREvent_Data_t Data)
 {
 }
Exemplo n.º 7
0
 public virtual void OnVREvent_Quit(VREvent_Data_t Data)
 {
 }
Exemplo n.º 8
0
 public virtual void OnVREvent_OverlayShown(VREvent_Data_t Data)
 {
 }
Exemplo n.º 9
0
 public virtual void OnVREvent_MouseButtonUp(VREvent_Data_t Data)
 {
 }
Exemplo n.º 10
0
 public virtual void OnVREvent_MouseMove(VREvent_Data_t Data)
 {
 }
Exemplo n.º 11
0
 public override void OnVREvent_MouseMove(VREvent_Data_t Data)
 {
     FormToShow.SimulateMouseMoveEvent((int)(Data.mouse.x * FormToShow.Width), (int)(Data.mouse.y * FormToShow.Height), 0);
 }
Exemplo n.º 12
0
 public override void OnVREvent_MouseButtonDown(VREvent_Data_t Data)
 {
     FormToShow.SimulateMouseDownEvent(ParseMouseButton(Data.mouse), (int)(Data.mouse.x * FormToShow.Width), (int)(Data.mouse.y * FormToShow.Height), 0);
 }
Exemplo n.º 13
0
 private void FormOverlay_OnVREvent_MouseButtonUp(VREvent_Data_t Data)
 {
 }
Exemplo n.º 14
0
 //Event handlers
 public override void OnVREvent_MouseButtonDown(VREvent_Data_t Data)
 {
     this.Controller.DisplayNotification("H3LLO WORLD", this, EVRNotificationType.Transient, EVRNotificationStyle.Contact_Active, new NotificationBitmap_t());
 }
Exemplo n.º 15
0
        private void ScreenShotTaken(VREvent_Data_t eventData)
        {
            var handle             = eventData.screenshot.handle;
            var notificationBitmap = new NotificationBitmap_t();

            if (_screenshotQueue.ContainsKey(handle))
            {
                var data       = _screenshotQueue[handle];
                var result     = data.result;
                var filePath   = $"{result.filePath}.png";
                var filePathVR = $"{result.filePathVR}.png";
                var filePathR  = $"{result.filePath}_r.png";
                var rect       = new Rectangle();
                if (File.Exists(filePath))
                {
                    rect = GetImageRectangle(filePath);
                    if (_settings.SubmitToSteam && _currentAppId != string.Empty)
                    {
                        var submitted = _ovr.SubmitScreenshotToSteam(result);
                        Debug.WriteLine($"Managed to submit the screenshot to Steam: {submitted}");
                    }
                    else
                    {
                        Debug.WriteLine("Will not submit the screenshot to Steam.");
                    }

                    if (_settings.SaveRightImage && File.Exists(filePathVR))
                    {
                        var bitmapR = GetRightEyeBitmap(rect, filePathVR);
                        SaveBitmapToPngFile(bitmapR, filePathR);
                    }

                    var image = Image.FromFile(filePath);
                    var msg   = data.screenshotMessage;
                    if (msg != null || _settings.TransmitAll)
                    {
                        var resIndex = _settings.ResponseResolution;
                        var res      = MainWindow.RES_MAP.Length > resIndex ? MainWindow.RES_MAP[resIndex] : 256;
                        var bitmap   = ResizeImage(image, res, res);
                        SetAlpha(ref bitmap, 255);
                        var imgb64data = GetBase64Bytes(bitmap);
                        if (msg != null)
                        {
                            _server.SendMessage(
                                msg.session,
                                JsonConvert.SerializeObject(new ScreenshotResponse
                            {
                                nonce = msg.nonce,
                                image = imgb64data
                            })
                                );
                        }
                        else if (data.byUser)
                        {
                            _server.SendMessageToAll(
                                JsonConvert.SerializeObject(new ScreenshotResponse
                            {
                                nonce = "",
                                image = imgb64data
                            })
                                );
                        }
                    }

                    if (_settings.Notifications && _settings.Thumbnail)
                    {
                        var bitmap = ResizeImage(image, 255, 255); // 256x256 should be enough for notification
                        SetAlpha(ref bitmap, 255);
                        notificationBitmap = BitmapUtils.NotificationBitmapFromBitmap(bitmap);
                    }
                    else
                    {
                        notificationBitmap = BitmapUtils.NotificationBitmapFromBitmap(Properties.Resources.logo);
                    }
                }
                else
                {
                    Debug.WriteLine($"Could not find screenshot after taking it: {filePath}");
                }

                if (_settings.Notifications && data.byUser)
                {
                    _ovr.EnqueueNotification(_notificationOverlayHandle, $"Screenshot taken!\n{rect.Width}x{rect.Height}px", notificationBitmap);
                }
                _screenshotQueue.Remove(handle);
            }
            else
            {
                if (_settings.Notifications)
                {
                    _ovr.EnqueueNotification(_notificationOverlayHandle, "Screenshot taken! (Unknown)", notificationBitmap);
                }
                Debug.WriteLine($"Screenshot handle does not exist in queue? Handle: {handle}");
            }
            Debug.WriteLine($"Screenshot taken done, handle: {eventData.screenshot.handle}");
        }