Esempio n. 1
0
 public void TurnOff()
 {
     if (this.pDevice != IntPtr.Zero)
     {
         SteamControllerLib.TurnOff(this.pDevice);
     }
 }
Esempio n. 2
0
        public Event ReadEvent()
        {
            if (this.pDevice == IntPtr.Zero)
            {
                return(null);
            }

            SteamControllerLib.Event libEvent;
            if (!SteamControllerLib.ReadEvent(this.pDevice, out libEvent))
            {
                return(null);
            }

            switch ((Event.EventTypeEnum)libEvent.eventType)
            {
            case Event.EventTypeEnum.Update:
                return(new UpdateEvent(ref libEvent));

            case Event.EventTypeEnum.Connection:
                return(new ConnectionEvent(ref libEvent));

            case Event.EventTypeEnum.Battery:
                return(new BatteryEvent(ref libEvent));
            }
            return(null);
        }
Esempio n. 3
0
 public void CommitPairing(bool connect)
 {
     if (this.pDevice != IntPtr.Zero)
     {
         SteamControllerLib.CommitPairing(this.pDevice, connect);
     }
 }
Esempio n. 4
0
 public void EnablePairing(bool enable)
 {
     if (this.pDevice != IntPtr.Zero)
     {
         SteamControllerLib.EnablePairing(this.pDevice, enable, 0);
     }
 }
Esempio n. 5
0
        public void PlayMelody(uint id)
        {
            if (this.pDevice == IntPtr.Zero)
            {
                return;
            }

            SteamControllerLib.PlayMelody(this.pDevice, id);
        }
Esempio n. 6
0
        public void TriggerHaptic(ushort motor, ushort onTime, ushort offTime, ushort count)
        {
            if (this.pDevice == IntPtr.Zero)
            {
                return;
            }

            SteamControllerLib.TriggerHaptic(this.pDevice, motor, onTime, offTime, count);
        }
Esempio n. 7
0
        public static SteamControllerDevice[] OpenControllers()
        {
            List <SteamControllerDevice> controllers = new List <SteamControllerDevice> ();

            IntPtr pEnum = SteamControllerLib.EnumControllerDevices();

            while (pEnum != IntPtr.Zero)
            {
                IntPtr pDevice = SteamControllerLib.Open(pEnum);
                if (pDevice != IntPtr.Zero)
                {
                    controllers.Add(new SteamControllerDevice(pDevice));
                }
                pEnum = SteamControllerLib.NextControllerDevice(pEnum);
            }

            return(controllers.ToArray());
        }
Esempio n. 8
0
 public void Close()
 {
     SteamControllerLib.Close(this.pDevice);
     this.pDevice = IntPtr.Zero;
 }