Giter Site home page Giter Site logo

neptune-hidapi.net's Introduction

neptune-hidapi.net

Steam Deck Controller (Neptune) HID Api Library for .Net

How to use

  • Download the .dll files from the releases section
  • Copy them to the root of your project
  • Right click, select settings and set the file to "Always copy to output dir"
  • Make sure your project is built for x64 platform. ** If not, go to Build > Configuration manager and add a new configuration for x64.
  • See below Example on how to grab controller inputs and write them to the console
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace neptune_hidapi.net
{
    internal class Program
    {
        static void Main(string[] args)
        {
            NeptuneController controller = new NeptuneController();
            controller.OnControllerInputReceived += Controller_OnControllerInputReceived;
            controller.LizardModeEnabled = true; //Mouse and Keyboard emulation enabled.
            controller.Open(); //Open the controller device.
            Console.WriteLine($"Controller Serial: {controller.SerialNumber}"); // Output the serial number. Only available once device has been opened.
            Console.ReadLine();
        }

        static DateTime lastUpdate = DateTime.Now;

        private static void Controller_OnControllerInputReceived(object sender, NeptuneControllerInputEventArgs e)
        {
            if ((DateTime.Now - lastUpdate).TotalMilliseconds > 100)
            {
                Console.CursorTop = 0;
                Console.CursorLeft = 0;
                foreach (var btn in e.State.ButtonState.Buttons)
                {
                    Console.WriteLine($"{btn}: {e.State.ButtonState[btn]}      ");
                }
                foreach (var axis in e.State.AxesState.Axes)
                {
                    Console.WriteLine($"{axis}: {e.State.AxesState[axis]}      ");
                }
                lastUpdate = DateTime.Now;
            }
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.