NolanHodge.GamingController 1.0.10

dotnet add package NolanHodge.GamingController --version 1.0.10                
NuGet\Install-Package NolanHodge.GamingController -Version 1.0.10                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: NolanHodge.GamingController, 1.0.10"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

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 Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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 1,340 11/12/2019