fix: Gamepad not detected due to window handler definition error#2826
fix: Gamepad not detected due to window handler definition error#2826w0wca7a wants to merge 5 commits intostride3d:masterfrom
Conversation
Add window handler
fixes SharpDX error
fix window descriptor
fix: Gamepad not detected due to window handle definition error
|
@dotnet-policy-service agree |
| public static extern void ClipCursor(IntPtr rect); | ||
|
|
||
| [DllImport("user32.dll")] | ||
| public static extern IntPtr GetForegroundWindow(); |
There was a problem hiding this comment.
How reliable is this to always get the game window? If there is a possibility that the game window may not be in focus, there may be a better way to do this with a GameWindow reference.
There was a problem hiding this comment.
Thanks for the review. It doesn't really matter how we get the Window handler, gamepad working with SharpDX.DirectInput depends from the CooperativeLevel mode. It seems that if I can make CooperativeLevel work in Exclusive mode, it will allow ForceFeedback to work. At the moment, Exclusive mode will crash Stride.Input when window not in a focus. I will try your recomendation.
|
Converting this to draft while the contributor gets back to us |
|
Sorry for the long delay. I can't get back now gamepads from true gamers. I hope to return to this PR in 2-3 months |
|
I tested connection/disconnection a game controller in a foreground/background game window, and also running two games that support game controllers. The game controller works in both simultaneously. |
PR Details
When connecting a Logitech RumblePad II gamepad,
SharpDX.DirectInputreturns an error related to an invalid window identifier.Related Issue
#1791
Types of changes
Checklist