NolanHodge.GamingController 1.0.10

.NET Framework 4.0
Install-Package NolanHodge.GamingController -Version 1.0.10
dotnet add package NolanHodge.GamingController --version 1.0.10
<PackageReference Include="NolanHodge.GamingController" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NolanHodge.GamingController --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NolanHodge.GamingController, 1.0.10"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NolanHodge.GamingController as a Cake Addin
#addin nuget:?package=NolanHodge.GamingController&version=1.0.10

// Install NolanHodge.GamingController as a Cake Tool
#tool nuget:?package=NolanHodge.GamingController&version=1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

GamingController

GamingController presents the IGamingController interface to the .NET framework for Xbox, Playstation, and Generic Controller device support.

Playstation Controller

  using NolanHodge.GamingController;
  
  PlaystationController Controller = new PlaystationController();
  
  Controller.Connected += (s,e) => { HandleConnectedAsync(); };
  Controller.Disconnected += (s,e) => { HandleDisconnectedAsync();  };
  Controller.Refresh();

Xbox Controller

  using NolanHodge.GamingController;
  
  XboxController Controller = new XboxController();
  
  Controller.Connected += (s,e) => { HandleConnectedAsync(); };
  Controller.Disconnected += (s,e) => { HandleDisconnectedAsync();  };
  Controller.Refresh();

Generic Controller

  using NolanHodge.GamingController;
  
  GenericController Controller = new GenericController();
  
  Controller.Connected += (s,e) => { HandleConnectedAsync(); };
  Controller.Disconnected += (s,e) => { HandleDisconnectedAsync();  };
  Controller.Refresh();

Auto-Determine Controller

  using NolanHodge.GamingController;
  
  void Determine()
  {
      GenericControllerController = new GenericController();
      Controller.Connected += (s,e) => 
      {
            switch (Controller.TypeString(Controller.Vendor()))
            {
             case "Xbox":
                 Controller = new XboxController();
             case "Playstation":
                 Controller = new PlaystationController();
             case "Generic":
                 break;
            }
      };

      Controller.Disconnected += (s,e) => { HandleDisconnectedAsync();  };
      
      Controller.Refresh();
   
      Task.Run(() => {Start(Controller)};);
  }
  
  void Start(IGamingController Controller)
  {
      while (true)
      {
           if (Controller.ButtonAPressed()) 
           {
               // Handle A button pressed.
           }

           Task.Delay(1000);
      }
  }

nuget

Product Versions
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.10 446 11/12/2019