Пример #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            EnableDebugWindow();

            DebugPrint(MethodInfo.GetCurrentMethod().Name, "Head Track Demo - window loaded");
            try
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "About to instantiate PLTLabsAPI object (version: " + PLTLabsAPI2.SDK_VERSION + ")");

                sdkversionlabel.Content = "Rev " + PLTLabsAPI2.SDK_VERSION;

                m_pltlabsapi = new PLTLabsAPI2(this);

                ConnectToPlantronicsDevice();

                SetupHeadRotation();
            }
            catch (Exception exc)
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "xception on connect! \r\n" + exc.ToString());

                MessageBox.Show("Exception on connect! " + exc.ToString(), "HeadTrackDiagnostics Error");
            }

            appversionlabel.Content = Assembly.GetEntryAssembly().GetName().Version;
        }
Пример #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (m_pltlabsapi != null)
     {
         if (m_pltConnection != null) // && m_registeredForHeadTracking)
         {
             if (m_pltConnection.isSubscribed(PLTService.MOTION_TRACKING_SVC))
             {
                 m_pltlabsapi.unsubscribe(PLTService.MOTION_TRACKING_SVC);
             }
             if (m_pltConnection.isSubscribed(PLTService.SENSOR_CAL_STATE_SVC))
             {
                 m_pltlabsapi.unsubscribe(PLTService.SENSOR_CAL_STATE_SVC);
             }
             // TODO, add the rest!
         }
         m_pltlabsapi.Shutdown();
         m_pltlabsapi = null;
     }
 }
Пример #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DebugPrint(MethodInfo.GetCurrentMethod().Name, "Head Track Demo - window loaded");
            try
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "About to instantiate PLTLabsAPI object");

                m_pltlabsapi = new PLTLabsAPI2(this);
            }
            catch (Exception exc)
            {
                ConnStatusLbl.Dispatcher.Invoke(new Action(delegate()
                {
                    ConnStatusLbl.Content = "Exception on connect! " + exc.ToString();
                    DeviceLbl.Content     = "-";

                    MessageBox.Show("Exception on connect! " + exc.ToString(), "HeadTrackDemo Error");
                }));
            }
        }
Пример #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            m_increasespeed          = new Timer();
            m_increasespeed.Interval = 10000;
            m_increasespeed.Elapsed += new ElapsedEventHandler(m_increasespeed_Elapsed);

            m_player1bat = new Bat();
            m_ball       = new Ball();

            BatTexture   = Content.Load <Texture2D>("bat");
            BallTexture  = Content.Load <Texture2D>("ball");
            BrickTexture = Content.Load <Texture2D>("brick");

            ReconfigureScreen();

            font = Content.Load <SpriteFont>("SpriteFont1");

            // Initialise Plantronics head tracking...
            m_pltlabsapi = new PLTLabsAPI2(this);
        }
 internal PLTConnection(PLTLabsAPI2 aPLTLabsAPI, PLTDevice aDevice)
 {
     //m_spokes = aSpokesConnection;
     m_pltlabsapi = aPLTLabsAPI;
     m_device     = aDevice;
 }