NolanHodge.GamingController 1.0.10

.NET Framework 4.0
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, 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

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 (2)

Showing the top 2 NuGet packages that depend on NolanHodge.GamingController:

Package Downloads
VCLua_Framework

Package Description

VB_Extensions

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.10 517 11/12/2019