本文整理汇总了C#中Leap.Controller.SetPolicy方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.SetPolicy方法的具体用法?C# Controller.SetPolicy怎么用?C# Controller.SetPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Leap.Controller
的用法示例。
在下文中一共展示了Controller.SetPolicy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInitialize
public void OnInitialize(CommunicationService com, int interval)
{
OnRelease();
m_communication = com;
m_interval = interval;
m_timer = new Stopwatch();
m_timer.Start();
m_listener = new LeapListener(this);
m_controller = new Controller();
m_controller.SetPolicy(m_controller.PolicyFlags | Controller.PolicyFlag.POLICY_IMAGES | Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
m_controller.AddListener(m_listener);
}
示例2: LeapMotionGestureControl
public LeapMotionGestureControl()
{
// Set up listener and controller
listener = new LeapMotionGestureControlListener();
controller = new Controller();
// Allow background frames, otherwise.. well, it's useless
controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
// Watch for circles
controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
controller.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
// Add on the listener
controller.AddListener(listener);
}
示例3: OnConnect
public override void OnConnect(Controller controller)
{
controller.SetPolicy(Controller.PolicyFlag.POLICY_IMAGES);
controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
controller.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
controller.EnableGesture(Gesture.GestureType.TYPE_SCREEN_TAP);
controller.Config.SetFloat("Gesture.ScreenTap.MinForwardVelocity", 30.0f);
controller.Config.SetFloat("Gesture.ScreenTap.HistorySeconds", .5f);
controller.Config.SetFloat("Gesture.ScreenTap.MinDistance", 1.0f);
controller.Config.SetFloat("Gesture.Circle.MinRadius", 10.0f);
controller.Config.SetFloat("Gesture.Circle.MinArc", .5f);
controller.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 40.0f);
controller.Config.SetFloat("Gesture.KeyTap.HistorySeconds", .2f);
controller.Config.SetFloat("Gesture.KeyTap.MinDistance", 1.0f);
controller.Config.Save();
this.eventDelegate.LeapEventNotification("onConnect");
}
示例4: Main
public static void Main()
{
// Create a sample listener and controller
SampleListener listener = new SampleListener();
Controller controller = new Controller();
controller.SetPolicy(Leap.Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
// Have the sample listener receive events from the controller
controller.AddListener(listener);
//creating socket
// UdpClient sendingClient = new UdpClient();
//sendingClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
//sendingClient.Connect("localhost", 4200);
//Socket sending_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
// IPAddress send_to_address = IPAddress.Parse("127.0.0.1");//localhost, for broadcast use ("192.168.2.255");
// IPEndPoint sending_end_point = new IPEndPoint(send_to_address, 4200);
/*
while(true)
{
// String text_to_send = "VR_TRACKER_SENSOR_0 42 24 66 0 0 0 0 0 0 1 2 3 4";
//byte[] send_buffer = Encoding.ASCII.GetBytes(text_to_send);
//Console.WriteLine("sending to address: {0} port: {1}", sending_end_point.Address, sending_end_point.Port);
try
{
//sending_socket.SendTo(send_buffer, sending_end_point);
//sendingClient.Send(send_buffer, send_buffer.Length, sending_end_point);
}
catch (Exception send_exception)
{
//exception_thrown = true;
Console.WriteLine(" Exception {0}", send_exception.Message);
}
Console.ReadLine();
//System.Threading.Thread.Sleep(1000);
}
*/
// Keep this process running until Enter is pressed
Console.WriteLine("Press Enter to quit...");
Console.ReadLine();
// Remove the sample listener when done
controller.RemoveListener(listener);
controller.Dispose();
}
示例5: Start
void Start ()
{
if (handController == null) {
Debug.LogWarning ("Cannot use LeapImageRetriever if there is no HandController!");
enabled = false;
return;
}
_controller = handController.GetLeapController ();
_controller.SetPolicy (Controller.PolicyFlag.POLICY_IMAGES);
}
示例6: Start
void Start()
{
if (HandController.Main == null) {
Debug.LogWarning("Could not find Main Hand Controller. Cannot use LeapImageRetriever if there is no Main Hand Controller!");
enabled = false;
return;
}
float gamma = 1f;
if (QualitySettings.activeColorSpace != ColorSpace.Linear) {
gamma = -Mathf.Log10(Mathf.GammaToLinearSpace(0.1f));
}
Shader.SetGlobalFloat("_LeapGlobalColorSpaceGamma", gamma);
_eyeTextureData[0] = new EyeTextureData();
_eyeTextureData[1] = new EyeTextureData();
_cachedCamera = GetComponent<Camera>();
_controller = HandController.Main.GetLeapController();
_controller.SetPolicy(Controller.PolicyFlag.POLICY_IMAGES);
}
示例7: leapinit
private void leapinit()
{
leapcontroller = new Controller();
Controller.PolicyFlag flags = Controller.PolicyFlag.POLICY_DEFAULT;
if (FBckgFrames[0]) flags = flags | Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES;
if (FHMD[0]) flags = flags | Controller.PolicyFlag.POLICY_OPTIMIZE_HMD;
leapcontroller.SetPolicy(flags);
leapdevice = leapcontroller.Devices[0];
}
示例8: OnConnect
public override void OnConnect(Controller controller)
{
controller.SetPolicy(Controller.PolicyFlag.POLICY_IMAGES);
controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
controller.EnableGesture(Gesture.GestureType.TYPE_SCREEN_TAP);
controller.Config.SetFloat("Gesture.Swipe.minVelocity", 750f);
this.eventDelegate.LeapEventNotification("onConnect");
}
示例9: StartController
/// <summary>
/// Starts the controller.
/// </summary>
/// <param name="onFrameArrived">On frame arrived.</param>
public void StartController(Action<Frame> onFrameArrived)
{
_listener = new FrameListener(onFrameArrived);
_leapController = new Controller(_listener);
_leapController.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
}
示例10: MainWindow
public MainWindow()
{
InitializeComponent();
this.controller = new Controller();
this.listener = new LeapEventListener(this);
this.iBox = controller.Frame().InteractionBox;
controller.AddListener(listener);
controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
Console.WriteLine("hi");
}
示例11: OnConnect
public override void OnConnect(Controller controller)
{
controller.SetPolicy(Controller.PolicyFlag.POLICY_IMAGES);
controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
this.eventDelegate.LeapEventNotification("onConnect");
}
示例12: MainWindow
public MainWindow()
{
InitializeComponent();
this.controller = new Controller();
this.listener = new LeapEventListener(this);
controller.AddListener(listener);
controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
}
示例13: Window_Loaded
private void Window_Loaded( object sender, RoutedEventArgs e )
{
leap = new Controller();
leap.SetPolicy( Controller.PolicyFlag.POLICY_IMAGES );
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
示例14: Init
static void Init()
{
var count = 0;
var start = System.DateTime.Now;
var con = new Controller(new FrameListener(x =>
{
count++;
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write("Frames: " + count);
var cur = System.DateTime.Now - start;
Console.Write(" | FPS: " + (count / cur.TotalSeconds));
OnFrameArrived(x);
}));
con.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
}