terrafx / terrafx.interop.windows

Interop bindings for Windows.
MIT License
253 stars 31 forks source link

Microsoft Game Development Kit (GDK) Support #319

Open ShadowMarker789 opened 2 years ago

ShadowMarker789 commented 2 years ago

Description

The Microsoft GDK contains very useful functionality that may be desirable to call from a .Net context.

Rationale

Examples of useful functionality can be such as GameInput where Microsoft Documentation says:

GameInput is the recommended API for all new code, regardless of the target platform, because it provides support across all Microsoft platforms (including earlier versions of Windows), and provides superior performance versus legacy APIs.

Proposed API

Perhaps an additional namespace sub-layer, TerraFX.Interop.Windows.Gdk as the namespace for these types, breaking down into various categories.

E.g.: IGameInput GetNextReading Could be accessed via TerraFX.Interop.Windows.Gdk.GameInput.GetNextReading with GameInput being the class that exposes the set of static methods. This is a lot of namespaces deep, but is that warranted?

Drawbacks

The GDK is iteratively being released, and may still be actively worked on. There might be quarterly releases of the GDK, I don't know how the GDK release schedule affects C# support for it.

Alternatives

The GDK functionality is a

functional superset of all legacy ... APIs

E.g.: XInput can be used to communicate with Xbox-style dual-axis gamepads, Windows.Gaming.Input can be used to communicate with other kinds of devices in C# if the Windows version minimum is met, and DirectInput should just-work as it did before.

Other thoughts

Are the header files available (e.g.: GameInput.h ) for porting regarding licensing requirements and restrictions?

Discussions (optional)

TBA/TBD

rickbrew commented 2 years ago

This might be best done as a separate package, especially since the GDK is on a different release schedule than the Windows SDK (at least I assume it is). Totally doable using ClangSharpPInvokeGenerator.

tannergooding commented 2 years ago

Not sure yet on if new package is better or worse but this something that I'd like to provide.

DirectX is technically "off cadence" now as well with the "Agility SDK".