public StillLife() { InitializeComponent(); ConfigFile config = new ConfigFile(@"config.ini"); speedUpDown = config.SettingGroups["Movement"].Settings["SpeedUpDown"].GetValueAsFloat(); speedLeftRight = config.SettingGroups["Movement"].Settings["SpeedLeftRight"].GetValueAsFloat(); idleTexturePosition.Width = config.SettingGroups["Idle"].Settings["IdleX"].GetValueAsInt(); idleTexturePosition.Height = config.SettingGroups["Idle"].Settings["IdleY"].GetValueAsInt(); timeTillIdle = config.SettingGroups["Idle"].Settings["IdleAfter"].GetValueAsFloat(); idleSpeed = config.SettingGroups["Idle"].Settings["IdleSpeed"].GetValueAsFloat(); leapController = new Controller(); leapListener = new LeapListener(); leapController.AddListener(leapListener); leapListener.LeapSwipe += new LeapListener.SwipeEvent(OnSwipe); leapListener.LeapRegisterFingers += new LeapListener.RegisterFingers(OnRegisterFingers); CalculateColumnsRows(); InitializeIdleValues(); stopWatch.Start(); updateThread = new Thread(UpdateThread); updateThread.Start(); }
public void connect() { if (connected) { // Remove the listener controller.RemoveListener(listener); controller.Dispose(); connected = false; connectbutton.Text = "Connect"; fps_label.Text = "disconnected"; } else { // Create listener and controller listener = new SampleListener(); listener.form = this; controller = new Controller(); if (controller.IsConnected) { controller.AddListener(listener); connectbutton.Text = "Disconnect"; connected = true; } } }
public Form1() { InitializeComponent(); oCamera = new InventorCamera(); controller = new Controller(); InitializeTexBox(); AddToLog("Component initialization."); Thread.Sleep(100); // wait for connection if (controller.Devices.IsEmpty) { AddToLog("ERROR: No connection to Leap Motion service."); AddToLog("ERROR: Connect device and restart application."); return; } else { AddToLog("Connected to Leap Motion service."); controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE); controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE); listener = new LeapEventListener(this); controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES); controller.AddListener(listener); } if (!oCamera.IsStarted()) AddToLog("ERROR: Inventor instance not found."); else AddToLog("Iventor instance found. "); if (!oCamera.IsOpened()) AddToLog("ERROR: Assembly, part or presentation document not found."); else AddToLog(oCamera.GetDocType() + " document found."); }
public LeapListener() { this.LeapInfo = new LeapFrame(); this.controller = new Controller(); this.listener = new LeapEventListener(this); controller.AddListener(listener); }
public MainWindow() { InitializeComponent(); this.controller = new Controller(); this.listener = new LeapEventListener(this); controller.AddListener(listener); }
private void InitLeapSensorAndRegisterToEvents() { _listener = new MotionListener(); _controller = new Controller(); _controller.AddListener(_listener); _listener.OnHandMoveOn += _listener_OnHandMoveOn; }
private LeapManager manager; //This provides access to leap data #endregion Fields #region Methods // Use this for initialization void Start() { manager = Camera.main.GetComponent<LeapManager>(); //This links to some leap data listener = new Leap.Listener (); //initializes the listener controller = new Leap.Controller (); //Initializes the controler controller.AddListener (listener); //Pipes the listener stream into the controler }
//public bool scratch; // Use this for initialization void Start() { print("Inizializzo controller"); listener = new Leap.Listener(); controller = new Leap.Controller(); controller.AddListener(listener); angle=0.0683f; }
//public Frame frame_read = new Frame(); public FrameDataForm() { InitializeComponent(); this.controller = new Controller(); this.listener = new LeapEventListener(this); controller.AddListener(listener); this.controller.SetPolicy (Controller.PolicyFlag.POLICY_IMAGES); }
static void Main(string[] args) { CustomListener listener = new CustomListener(); Controller controller = new Controller(); controller.AddListener(listener); Console.ReadKey(); controller.Dispose(); }
public LeapHandler() { // Create a sample listener and controller _LeapListener = new LeapListener(); _Controller = new Controller(); // Have the sample listener receive events from the controller _Controller.AddListener(_LeapListener); }
public void run() { if (!isListening) { isListening = true; controller = new Controller(); controller.AddListener(this); } }
public LeapMotinn() { controller = new Controller(); if (controller.IsConnected) { IsConnected = true; listener = new LeapListener(); controller.AddListener(listener); } }
public MainViewModel(Controller controller, CustomLeapListener listener, GameModel gameModel) { GameModel = gameModel; _listener = listener; _controller = controller; _controller.AddListener(_listener); _dispatcher = Application.Current.Dispatcher; RegisterEvents(); _enableMouse = false; }
static void Main(string[] args) { Console.Title = "Leap Mousion v2.0"; Console.WriteLine("Leap Mousion v2.0 by TangoChen :)\r\n------------------------------------\r\nBlog: TangoChen.com\r\nYoutube Channel: www.youtube.com/tan9ochen\r\n--------------------\r\nTwitter:\ttwitter.com/tangochen\t@TangoChen\r\n微博(Weibo):\tweibo.com/tangochen\t@TangoChen\r\n--------------------\r\nPress any key to exit...\r\n--------------------"); // Create a sample listener and controller SampleListener listener = new SampleListener(); Controller controller = new Controller(); foreach (string arg in args) { switch (arg.Substring(0, 1).ToLower()) { case "l": // L = Set isLeftHanded = true; listener.isLeftHanded = true; break; case "s": // Scale float.TryParse(arg.Substring(1), out listener.moveScale); break; case "r": // Reverse Orientation /* * It won't just reverse the horizontal axes but also change the fingerIndex... * So this is used when the device get reversed horizontal axes * and you don't want to click the [Reverse Orientation] inside the [Leap Motion Controller Settings] or * rotate the device... */ listener.isReversed = true; break; case "c": // Click-Only listener.isClickOnly = true; break; } } Console.WriteLine( "Speed: " + listener.moveScale.ToString() + "\r\nClick-Only: " + listener.isClickOnly.ToString() + "\r\nReversed: " + listener.isReversed.ToString() + "\r\nLeft Handed Mode: " + (listener.isLeftHanded ? "Enabled" : "Disabled") + "\r\n--------------------" ); // Receive frames of tracking data while in the background controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES); // Have the sample listener receive events from the controller controller.AddListener(listener); // Keep this process running until any key is pressed Console.ReadKey(true); //System.Diagnostics.Process.Start("pause"); Won't work... // Remove the sample listener when done controller.RemoveListener(listener); controller.Dispose(); }
public Main() { InitializeComponent(); this.controller = new Controller(); this.listener = new LeapEventListener(this); controller.AddListener(listener); bitmapLeft = new Bitmap(640, 240, System.Drawing.Imaging.PixelFormat.Format8bppIndexed); bitmapRight = new Bitmap(640, 240, System.Drawing.Imaging.PixelFormat.Format8bppIndexed); InitializeBitmap(bitmapLeft); InitializeBitmap(bitmapRight); }
static void Main( string[] args ) { SampleListener listener = new SampleListener(); Controller leap = new Controller(); leap.AddListener( listener ); Console.WriteLine( "Press Enter to quit..." ); Console.ReadLine(); leap.RemoveListener( listener ); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { _listener = new MotionListener(); _controller = new Controller(); _controller.AddListener(_listener); _listener.OnFingersCount += _listener_OnFingersCount; _listener.OnHandMoveOnX += _listener_OnHandMoveOnX; _listener.OnHandMoveOnY += _listener_OnHandMoveOnY; _listener.OnHandMoveOnZ += _listener_OnHandMoveOnZ; _listener.OnHandMoveOn += _listener_OnHandMoveOn; }
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); }
// Use this for initialization void Start() { print("Inizializzo controller"); listener = new Leap.Listener(); controller = new Leap.Controller(); controller.AddListener(listener); controller.EnableGesture(Leap.Gesture.GestureType.TYPECIRCLE); controller.EnableGesture(Leap.Gesture.GestureType.TYPEKEYTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESCREENTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESWIPE); hasPaused=false; }
public LeapPaintMain() { InitializeComponent(); // Create a sample listener and controller listener = new LeapWrapper.LeapListerner(); listener.sensetivity = 3; hScrollBar1.Value = 100; zTrigger = hScrollBar1.Value; lblzTrigger.Text = hScrollBar1.Value.ToString(); controller = new Leap.Controller(); controller.AddListener(listener); }
// Use this for initialization void Start() { print("Inizializzo controller"); listener = new Leap.Listener(); controller = new Leap.Controller(); controller.AddListener(listener); controller.EnableGesture(Leap.Gesture.GestureType.TYPECIRCLE); controller.EnableGesture(Leap.Gesture.GestureType.TYPEKEYTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESCREENTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESWIPE); hasPaused = false; }
static void Main(string[] args) { ReportingListener listener = new ReportingListener(new Reporter()); Controller controller = new Controller(); controller.AddListener(listener); Console.WriteLine("Listening! Press any key when you're finished to exit."); Console.ReadKey(); controller.RemoveListener(listener); controller.Dispose(); }
/// <summary> /// Constructor for LeapInterface class /// </summary> public LeapInterface() { // Create a listener and controller this.listener = new LeapListener(); this.controller = new Controller(); // Have the sample listener receive events from the controller controller.AddListener(listener); controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES); // Register event handler listener.GestureMade += new EventHandler<GestureEvent>(ProcessGesture); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here currentState = StateMachine.Instance; currentState.state = StateMachine.ScreenState.GAME_MENU; StateMachine.Instance.resWidth = graphics.GraphicsDevice.Viewport.Width; StateMachine.Instance.resHeight = graphics.GraphicsDevice.Viewport.Height; leapController = new Controller(); listener = new SingleListener(); leapController.EnableGesture(Gesture.GestureType.TYPE_CIRCLE); leapController.EnableGesture(Gesture.GestureType.TYPESCREENTAP); leapController.AddListener(listener); base.Initialize(); }
public AppModel() { var controller = new Controller(); var listener = new FrameListener(); controller.AddListener(listener); AppDomain.CurrentDomain.ProcessExit += (o, e) => { controller.RemoveListener(listener); listener.Dispose(); controller.Dispose(); }; listener.FrameArrived += listener_FrameArrived; }
// Use this for initialization void Start() { print("Inizializzo controller"); listener = new Leap.Listener(); controller = new Leap.Controller(); controller.AddListener(listener); controller.EnableGesture(Leap.Gesture.GestureType.TYPECIRCLE); controller.EnableGesture(Leap.Gesture.GestureType.TYPEKEYTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESCREENTAP); controller.EnableGesture(Leap.Gesture.GestureType.TYPESWIPE); mustPause=false; temp=0.0f; scratch=false; audio.pitch=1.0f; counter=0; }
public static void Main() { // Create a sample listener and controller var listener = new LeapListener(); var controller = new Controller(); // Have the sample listener receive events from the controller controller.AddListener(listener); // 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(); }
public static void Main() { using (UniListener listener = new UniListener()) { using (Controller controller = new Controller()) { controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES); // Have the listener receive events from the controller controller.AddListener(listener); // Keep this process running until Enter is pressed Console.WriteLine("Press Enter to quit..."); string result = Console.ReadLine(); // Remove the listener when done controller.RemoveListener(listener); } } }
/* public LeapListener MyListener { get { return (LeapListener)GetValue(MyListenerProperty); } set { SetValue(MyListenerProperty, value); } } // Using a DependencyProperty as the backing store for MyListener. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyListenerProperty = DependencyProperty.Register("MyListener", typeof(LeapListener), typeof(MainWindow), new PropertyMetadata(new LeapListener())); */ public MainWindow() { InitializeComponent(); DataContext = this; // Create a sample listener and controller Listener = new LeapListener(); //mGrid.DataContext = MyListener; Controller = new Controller(); //// Have the sample listener receive events from the controller Controller.AddListener(Listener); //// Remove the sample listener when done //controller.RemoveListener (listener); //controller.Dispose (); mGrid.DataContext = Listener; }
public override void Load() { try { IsEnabled = true; _listener = new CustomListener(); _listener.Init += _listener_Init; _listener.Frame += _listener_Frame; _listener.Exit += _listener_Exit; _listener.Connect += _listener_Connect; _listener.Disconnect += _listener_Disconnect; _leap = new Controller(); _leap.AddListener(_listener); } catch (Exception exc) { Logger.Instance.Error(exc.Message, exc); IsEnabled = false; } }