view Orchestland/Assets/LeapMotion+OVR/SystemWipe/SystemWipeRecognizerNative.cs @ 1:f7675884f2a1

Add Orchestland project
author Daiki OYAKAWA <e135764@ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2015 23:09:20 +0900
parents
children
line wrap: on
line source

using System;
using System.Runtime.InteropServices;

namespace Leap.Util
{
  public enum Direction : int { Invalid, Up, Down };
  public enum Status : int { Invalid, ErrorCannotAccessImages, Idle, SwipeBegin, SwipeUpdate, SwipeComplete, SwipeAbort, InfoQueueEmpty };

  [StructLayout(LayoutKind.Sequential)]
  public struct SystemWipeInfo
  {
    public Direction Direction;
    public Status Status;
    public float Progress;
  }

  public class SystemWipeRecognizerNative
  {
#   if UNITY_STANDALONE_OSX
      const CallingConvention LeapCallingConvention = CallingConvention.Cdecl;
#   else
      const CallingConvention LeapCallingConvention = CallingConvention.StdCall;
#   endif

    [UnmanagedFunctionPointer(LeapCallingConvention)]
    public delegate void CallbackSystemWipeInfoDelegate(SystemWipeInfo systemWipeInfo);

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern void SetSystemWipeRecognizerCallback(IntPtr property);

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern void EnableSystemWipeRecognizer();

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern void DisableSystemWipeRecognizer();

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern bool WasLastImageAccessOk();

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern int GetFrameCount();

    [DllImport("SystemWipeRecognizerDll", CallingConvention = LeapCallingConvention)]
    public static extern SystemWipeInfo GetNextSystemWipeInfo();
  }
}