-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add overlay mouse input (WARNING: interferes with playspace mover):
- Implement InputSnapshot for mouse events and scroll events. - WARNING: This breaks OVR Advanced Settings motion / playspace mover! - This may be due to the overlay flag MakeOverlaysInteractiveIfVisible causing all input events to be intercepted? Not sure. - Either way this needs fixing in the next iteration. - Poll mouse events and scroll events, and pass it to the InputSnapshot. - Poll OpenVR quit event; exit the application when this happens. - Move the OpenVR shutdown responsibility to HVOverlay. - Run in unlimited overlay refresh rate due to an issue encountered with WaitFrameSync at the moment. - Increase the windowless window size so that more items show up in the Shortcuts by default. - Enable drag to scroll on all tabs when windowless.
- Loading branch information
Showing
5 changed files
with
231 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Numerics; | ||
using Veldrid; | ||
|
||
namespace Hai.HView.Overlay; | ||
|
||
public class HOverlayInputSnapshot : InputSnapshot | ||
{ | ||
public bool IsMouseDown(MouseButton button) => _mouseDown[(int)button]; | ||
public IReadOnlyList<KeyEvent> KeyEvents => _keyEvents; | ||
public IReadOnlyList<MouseEvent> MouseEvents => _mouseEvents; | ||
public IReadOnlyList<char> KeyCharPresses => _keyCharPresses; | ||
public Vector2 MousePosition { get; private set; } = Vector2.Zero; | ||
public float WheelDelta { get; private set; } | ||
|
||
private readonly List<KeyEvent> _keyEvents = new List<KeyEvent>(); | ||
private readonly List<MouseEvent> _mouseEvents = new List<MouseEvent>(); | ||
private readonly List<char> _keyCharPresses = new List<char>(); | ||
private readonly bool[] _mouseDown = new bool[(int)MouseButton.LastButton]; | ||
private Vector2 _windowSize; | ||
|
||
public void SetWindowSize(Vector2 windowSize) | ||
{ | ||
_windowSize = windowSize; | ||
} | ||
|
||
public void MouseMove(Vector2 relativeCoords) | ||
{ | ||
MousePosition = relativeCoords * _windowSize; | ||
} | ||
|
||
public void Deaccumulate() | ||
{ | ||
WheelDelta = 0f; | ||
} | ||
|
||
public void Scrolling(float delta) | ||
{ | ||
Console.WriteLine($"Scrolling event {delta}"); | ||
WheelDelta += delta; | ||
} | ||
|
||
public void MouseDown(MouseButton veldridButton) | ||
{ | ||
Console.WriteLine($"MouseDown event {veldridButton}"); | ||
_mouseEvents.Add(new MouseEvent(veldridButton, true)); | ||
_mouseDown[(int)veldridButton] = true; | ||
} | ||
|
||
public void MouseUp(MouseButton veldridButton) | ||
{ | ||
Console.WriteLine($"MouseUp event {veldridButton}"); | ||
_mouseEvents.Add(new MouseEvent(veldridButton, false)); | ||
_mouseDown[(int)veldridButton] = false; | ||
} | ||
} |
Oops, something went wrong.