I've seen some examples of using Windows.Gaming.Input in C++ console apps but is there a way to access it in a non-UWP C# project as well?
Thanks,
I've managed to do this by doing the following:
*.csproj
file in a text editor, e.g. notepad.<TargetPlatformVersion>10.0</TargetPlatformVersion>
to the *.csproj
file. You can put it after the <TargetFrameworkVersion/>
entry.<TargetPlatform>
and <TargetFramework>
.System.Runtime.WindowsRuntime
reference (I used v4.7.0, newest stable version at the time) with nuget, or manually browse for the DLL file on your system.Windows.Gaming
reference.*.cs
files, you'll want to use the reference with using Windows.Gaming.Input;
. If the reference is not found, try including it outside the namespace. Or you can also try using global::Windows.Gaming.Input;
instead.but is there a way to access it in C# with UWP as well?
Sure, you could access Windows.Gaming.Input
with C# within UWP platform. For example,
var controllers = RawGameController.RawGameControllers;
foreach (var item in controllers)
{
var name = item.DisplayName;
}
Unfortunately, there is not c# project could be referred, if you do want to c# project, please feel free post your requirement with Windows Feed Backhub app.