From 8e8d896f6efbfc76762c367b8e38716e096798ac Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Wed, 20 Apr 2022 20:55:29 +0530 Subject: [PATCH v2] include: Add IArcadeStick interface in windows.gaming.input.idl Signed-off-by: Biswapriyo Nath --- include/windows.gaming.input.idl | 93 ++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/include/windows.gaming.input.idl b/include/windows.gaming.input.idl index 4e9bb6e..e36c86e 100644 --- a/include/windows.gaming.input.idl +++ b/include/windows.gaming.input.idl @@ -33,12 +33,17 @@ import "windows.devices.power.idl"; #endif namespace Windows.Gaming.Input { + typedef enum ArcadeStickButtons ArcadeStickButtons; typedef enum GamepadButtons GamepadButtons; typedef enum GameControllerButtonLabel GameControllerButtonLabel; typedef enum GameControllerSwitchKind GameControllerSwitchKind; typedef enum GameControllerSwitchPosition GameControllerSwitchPosition; + typedef struct ArcadeStickReading ArcadeStickReading; typedef struct GamepadReading GamepadReading; typedef struct GamepadVibration GamepadVibration; + interface IArcadeStick; + interface IArcadeStickStatics; + interface IArcadeStickStatics2; interface IGameController; interface IGameControllerBatteryInfo; interface IGamepad; @@ -47,15 +52,20 @@ namespace Windows.Gaming.Input { interface IGamepadStatics2; interface IRawGameController; interface IRawGameController2; + runtimeclass ArcadeStick; runtimeclass Gamepad; runtimeclass Headset; runtimeclass RawGameController; declare { + interface Windows.Foundation.EventHandler; interface Windows.Foundation.EventHandler; interface Windows.Foundation.EventHandler; interface Windows.Foundation.TypedEventHandler; interface Windows.Foundation.TypedEventHandler; + interface Windows.Foundation.Collections.IIterator; + interface Windows.Foundation.Collections.IIterable; + interface Windows.Foundation.Collections.IVectorView; interface Windows.Foundation.Collections.IIterator; interface Windows.Foundation.Collections.IIterable; interface Windows.Foundation.Collections.IVectorView; @@ -66,6 +76,27 @@ namespace Windows.Gaming.Input { interface Windows.Foundation.Collections.IVector; } + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + flags + ] + enum ArcadeStickButtons + { + None = 0x0, + StickUp = 0x1, + StickDown = 0x2, + StickLeft = 0x4, + StickRight = 0x8, + Action1 = 0x10, + Action2 = 0x20, + Action3 = 0x40, + Action4 = 0x80, + Action5 = 0x100, + Action6 = 0x200, + Special1 = 0x400, + Special2 = 0x800 + }; + [ contract(Windows.Foundation.UniversalApiContract, 1.0), flags @@ -193,6 +224,13 @@ namespace Windows.Gaming.Input { UpLeft = 8 }; + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + struct ArcadeStickReading + { + UINT64 Timestamp; + Windows.Gaming.Input.ArcadeStickButtons Buttons; + }; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] struct GamepadReading { @@ -215,6 +253,47 @@ namespace Windows.Gaming.Input { DOUBLE RightTrigger; }; + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + exclusiveto(Windows.Gaming.Input.ArcadeStick), + uuid(b14a539d-befb-4c81-8051-15ecf3b13036) + ] + interface IArcadeStick : IInspectable + requires Windows.Gaming.Input.IGameController + { + HRESULT GetButtonLabel([in] Windows.Gaming.Input.ArcadeStickButtons button, + [out] [retval] Windows.Gaming.Input.GameControllerButtonLabel* value); + HRESULT GetCurrentReading([out] [retval] Windows.Gaming.Input.ArcadeStickReading* value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + exclusiveto(Windows.Gaming.Input.ArcadeStick), + uuid(5c37b8c8-37b1-4ad8-9458-200f1a30018e) + ] + interface IArcadeStickStatics : IInspectable + { + [eventadd] HRESULT ArcadeStickAdded([in] Windows.Foundation.EventHandler* value, + [out] [retval] EventRegistrationToken* token); + [eventremove] HRESULT ArcadeStickAdded([in] EventRegistrationToken token); + [eventadd] HRESULT ArcadeStickRemoved([in] Windows.Foundation.EventHandler* value, + [out] [retval] EventRegistrationToken* token); + [eventremove] HRESULT ArcadeStickRemoved([in] EventRegistrationToken token); + [propget] HRESULT ArcadeSticks([out] [retval] Windows.Foundation.Collections.IVectorView** value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Gaming.Input.ArcadeStick), + uuid(52b5d744-bb86-445a-b59c-596f0e2a49df) + ] + interface IArcadeStickStatics2 : IInspectable + requires Windows.Gaming.Input.IArcadeStickStatics + { + HRESULT FromGameController([in] Windows.Gaming.Input.IGameController* gameController, + [out] [retval] Windows.Gaming.Input.ArcadeStick** value); + } + [ contract(Windows.Foundation.UniversalApiContract, 1.0), uuid(1baf6522-5f64-42c5-8267-b9fe2215bfbd) @@ -345,6 +424,20 @@ namespace Windows.Gaming.Input { HRESULT TryGetBatteryReport([out, retval] Windows.Devices.Power.BatteryReport **value); } + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + marshaling_behavior(agile), + static(Windows.Gaming.Input.IArcadeStickStatics, Windows.Foundation.UniversalApiContract, 3.0), + static(Windows.Gaming.Input.IArcadeStickStatics2, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass ArcadeStick + { + [default] interface Windows.Gaming.Input.IArcadeStick; + interface Windows.Gaming.Input.IGameController; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Gaming.Input.IGameControllerBatteryInfo; + } + [ contract(Windows.Foundation.UniversalApiContract, 1.0), marshaling_behavior(agile), -- 2.36.0