Exemplo n.º 1
0
    void Awake()
    {
        mainSlider = new SelectableSlider1D(3, 0.3f, SliderAxis, false, 0, SliderSize, 0.5f, "Something");
        mainSlider.ValueChangeOnOffAxis = true;
        mainSlider.PrimaryPointCreate  += new System.EventHandler <HandFocusEventArgs>(mainSlider_PrimaryPointCreate);
        mainSlider.ValueChange         += new System.EventHandler <ValueEventArgs>(mainSlider_ValueChange);
        mainSlider.Scroll    += new System.EventHandler <ValueEventArgs>(mainSlider_Scroll);
        mainSlider.ItemHover += new System.EventHandler <IndexEventArgs>(mainSlider_ItemHover);

        AddListener(mainSlider);
    }
Exemplo n.º 2
0
    void Awake()
    {
        mainSlider = new SelectableSlider1D(SliderItems, 0.3f, SliderAxis, false, 0, SliderSize, 0.5f, "Something");
        mainSlider.ValueChangeOnOffAxis = true;
        mainSlider.PrimaryPointCreate += new System.EventHandler<HandFocusEventArgs>(mainSlider_PrimaryPointCreate);
        mainSlider.ValueChange += new System.EventHandler<ValueEventArgs>(mainSlider_ValueChange);
        mainSlider.Scroll += new System.EventHandler<ValueEventArgs>(mainSlider_Scroll);
        mainSlider.ItemHover += new System.EventHandler<IndexEventArgs>(mainSlider_ItemHover);

        AddListener(mainSlider);
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Awake()
    {
        cursorSlider = new SelectableSlider2D(1, 1);
        cursorSlider.ValueChangeOnOffAxis = true;
        cursorSlider.PrimaryPointCreate  += new System.EventHandler <HandFocusEventArgs>(cursorSlider_PrimaryPointCreate);
        cursorSlider.PrimaryPointDestroy += new System.EventHandler <IdEventArgs>(cursorSlider_PrimaryPointDestroy);
        cursorSlider.ValueChange         += new System.EventHandler <Value2EventArgs>(cursorSlider_ValueChange);

        // we create the click slider as a separate slider so we can move it around independently from the cursorSlider
        clickSlider = new SelectableSlider1D(1, 0, Axis.Z, false, 0, ClickSliderSize, 0, "Something");
        clickSlider.ValueChangeOnOffAxis = true;
        clickSlider.PrimaryPointCreate  += new System.EventHandler <HandFocusEventArgs>(clickSlider_PrimaryPointCreate);
        clickSlider.PrimaryPointUpdate  += new System.EventHandler <HandEventArgs>(clickSlider_PrimaryPointUpdate);
        clickSlider.ValueChange         += new System.EventHandler <ValueEventArgs>(clickSlider_ValueChange);

        AddListener(cursorSlider);
        AddListener(clickSlider);

        cursorPosition     = new Vector2(0, 0);
        clickPosition      = new Vector2(0, 0);
        NITEGUI.NiteCursor = this;
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Awake()
    {
        cursorSlider = new SelectableSlider2D(1,1);
        cursorSlider.ValueChangeOnOffAxis = true;
        cursorSlider.PrimaryPointCreate += new System.EventHandler<HandFocusEventArgs>(cursorSlider_PrimaryPointCreate);
        cursorSlider.PrimaryPointDestroy += new System.EventHandler<IdEventArgs>(cursorSlider_PrimaryPointDestroy);
        cursorSlider.ValueChange += new System.EventHandler<Value2EventArgs>(cursorSlider_ValueChange);

        // we create the click slider as a separate slider so we can move it around independently from the cursorSlider
        clickSlider = new SelectableSlider1D(1, 0, Axis.Z, false, 0, ClickSliderSize, 0, "Something");
        clickSlider.ValueChangeOnOffAxis = true;
        clickSlider.PrimaryPointCreate += new System.EventHandler<HandFocusEventArgs>(clickSlider_PrimaryPointCreate);
        clickSlider.PrimaryPointUpdate += new System.EventHandler<HandEventArgs>(clickSlider_PrimaryPointUpdate);
        clickSlider.ValueChange += new System.EventHandler<ValueEventArgs>(clickSlider_ValueChange);

        AddListener(cursorSlider);
        AddListener(clickSlider);

        cursorPosition = new Vector2(0,0);
        clickPosition = new Vector2(0,0);
        NITEGUI.NiteCursor = this;
    }
Exemplo n.º 5
0
        //constructor function
        public ViewingPaneForm()
        {
            InitializeComponent();

            #region Initializations
            CheckForIllegalCrossThreadCalls = false;
            this.context                  = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out this.scriptNode);
            this.sessionManager           = new NITE.SessionManager(this.context, "Wave,Click", "RaiseHand");
            this.Instruction_Display.Text = "Connected to the Kinect Camera";
            this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (this.depth == null)
            {
                throw new Exception("Viewer must have a depth node!");
            }
            this.hands = context.FindExistingNode(NodeType.Hands) as HandsGenerator;
            this.hands.SetSmoothing(0.8f);
            #endregion

            #region Setup Components
            pushDetector    = new PushDetector("PushDetector");
            aux_pushDect    = new PushDetector("Auxilary Push Detector");
            slider          = new SelectableSlider1D(1, Axis.X);
            swipeDetector   = new SwipeDetector("SwipeDectector");
            steadyDetector  = new SteadyDetector(350, 15);
            broadcaster     = new Broadcaster("Broadcaster");
            aux_broadcaster = new Broadcaster("Auxilary Broadcaster");
            router          = new FlowRouter("router");
            #endregion

            #region SignalRouting
            this.sessionManager.AddListener(this.router);
            this.router.ActiveListener = this.steadyDetector;

            this.broadcaster.AddListener(pushDetector);
            this.broadcaster.AddListener(swipeDetector);

            this.aux_broadcaster.AddListener(this.slider);
            this.aux_broadcaster.AddListener(this.aux_pushDect);
            #endregion

            #region SetUp Drawing Function
            this.histogram = new int[this.depth.DeviceMaxDepth];
            MapOutputMode mapMode = this.depth.MapOutputMode;
            this.bitmap       = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            this.shouldRun    = true;
            this.readerThread = new Thread(RenderThread);
            this.readerThread.Start();
            #endregion

            #region setProp values

            vars = new configurationVars();
            this.sessionManager.PrimaryStaticTimeout = 7;
            vars.SteadyReq        = 1000;
            vars.SteadyStddevReq  = 1;
            vars.SwipeVelmin      = 0.2f;
            vars.SwipeMinDuration = 500;
            vars.SwipeXangle      = 45;
            vars.SwipeYangle      = 45;
            vars.CircleMaxError   = 2;
            vars.CircleRadMin     = 80;
            vars.SliderHeight     = 100;
            vars.SliderWidth      = 200;
            vars.SwipeUseSteady   = true;
            vars.SwipeSteadyDur   = 75;

            this.populateConfiguration();
            this.customizeSwipe();
            this.customizeSteady();
            this.customizeCircle();
            #endregion

            #region Event Registration
            this.sessionManager.SessionStart         += new EventHandler <PositionEventArgs>(sessionManager_SessionStart);
            this.sessionManager.SessionFocusProgress += new EventHandler <SessionProgressEventArgs>(sessionManager_SessionFocusProgress);
            this.sessionManager.SessionEnd           += new EventHandler(sessionManager_SessionEnd);
            this.hands.HandDestroy        += new EventHandler <HandDestroyEventArgs>(hands_HandDestroy);
            this.hands.HandCreate         += new EventHandler <HandCreateEventArgs>(hands_HandCreate);
            this.pushDetector.Push        += new EventHandler <VelocityAngleEventArgs>(pushDetector_Push);
            this.swipeDetector.SwipeRight += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeRight);
            this.swipeDetector.SwipeLeft  += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeLeft);
            this.swipeDetector.SwipeUp    += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeUp);
            this.swipeDetector.SwipeDown  += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeDown);
            this.steadyDetector.Steady    += new EventHandler <SteadyEventArgs>(steadyDetector_Steady);
            this.slider.ValueChange       += new EventHandler <ValueEventArgs>(slider_ValueChange);
            this.aux_pushDect.Push        += new EventHandler <VelocityAngleEventArgs>(aux_pushDect_Push);


            //aux_pushDect.
            #endregion
        }