// 初期化 private void xnInitialize() { // コンテキストの初期化 ScriptNode scriptNode; context = Context.CreateFromXmlFile(CONFIG_XML_PATH, out scriptNode); // イメージジェネレータの作成 image = context.FindExistingNode(NodeType.Image) as ImageGenerator; if (image == null) { throw new Exception(context.GlobalErrorState); } // NITEのためのセッションマネージャを作成 sessionManager = new SessionManager(context, "Wave,Click", "RaiseHand"); // セッションの開始と終了を通知するコールバックを登録する sessionManager.SessionStart += new EventHandler <PositionEventArgs>(sessionManager_SessionStart); sessionManager.SessionEnd += new EventHandler(sessionManager_SessionEnd); sessionManager.SessionFocusProgress += new EventHandler <SessionProgressEventArgs>(sessionManager_SessionFocusProgress); // Wave(左右運動の検出器) swipeDetector = new NITE.SwipeDetector(); swipeDetector.GeneralSwipe += new EventHandler <DirectionVelocityAngleEventArgs>(swipeDetector_GeneralSwipe); swipeDetector.SwipeUp += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeUp); swipeDetector.SwipeDown += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeDown); swipeDetector.SwipeRight += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeRight); swipeDetector.SwipeLeft += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeLeft); // リスナーに追加する sessionManager.AddListener(swipeDetector); // ジェネレータの動作を開始する context.StartGeneratingAll(); }
// 初期化 private void xnInitialize() { // コンテキストの初期化 ScriptNode scriptNode; context = Context.CreateFromXmlFile(CONFIG_XML_PATH, out scriptNode); // イメージジェネレータの作成 image = context.FindExistingNode(NodeType.Image) as ImageGenerator; if (image == null) { throw new Exception(context.GlobalErrorState); } // NITEのためのセッションマネージャを作成 sessionManager = new SessionManager(context, "Wave,Click", "RaiseHand"); // セッションの開始と終了を通知するコールバックを登録する sessionManager.SessionStart += new EventHandler<PositionEventArgs>(sessionManager_SessionStart); sessionManager.SessionEnd += new EventHandler(sessionManager_SessionEnd); sessionManager.SessionFocusProgress += new EventHandler<SessionProgressEventArgs>(sessionManager_SessionFocusProgress); // Wave(左右運動の検出器) swipeDetector = new NITE.SwipeDetector(); swipeDetector.GeneralSwipe += new EventHandler<DirectionVelocityAngleEventArgs>(swipeDetector_GeneralSwipe); swipeDetector.SwipeUp += new EventHandler<VelocityAngleEventArgs>(swipeDetector_SwipeUp); swipeDetector.SwipeDown += new EventHandler<VelocityAngleEventArgs>(swipeDetector_SwipeDown); swipeDetector.SwipeRight += new EventHandler<VelocityAngleEventArgs>(swipeDetector_SwipeRight); swipeDetector.SwipeLeft += new EventHandler<VelocityAngleEventArgs>(swipeDetector_SwipeLeft); // リスナーに追加する sessionManager.AddListener(swipeDetector); // ジェネレータの動作を開始する context.StartGeneratingAll(); }