Esempio n. 1
0
        private void UpdateMouse <T>(
            UINodeSet <T> nodes,
            ControlSet input,
            Vector2 draw_offset) where T : UINode
        {
            if (input.HasEnumFlag(ControlSet.MouseButtons))
            {
                bool input_used = update_mouse_input(
                    ref LeftMouseDown, MouseButtons.Left, draw_offset);
                if (RightClickActive && !input_used)
                {
                    update_mouse_input(
                        ref RightMouseDown, MouseButtons.Right, draw_offset);
                }
            }

            if (input.HasEnumFlag(ControlSet.MouseMove))
            {
                if (OnScreenBounds(draw_offset).Contains(
                        (int)Global.Input.mousePosition.X,
                        (int)Global.Input.mousePosition.Y))
                {
                    if (nodes != null)
                    {
                        nodes.MouseMove(this as T);
                    }

                    if (LeftMouseDown || RightMouseDown)
                    {
                        mouse_click_graphic();
                    }
                    else
                    {
                        mouse_highlight_graphic();
                    }
                }
            }

            if (input.HasEnumFlag(ControlSet.Mouse))
            {
                if (IsSlider && LeftMouseDown &&
                    OnScreenBounds(draw_offset).Contains(
                        (int)Global.Input.mousePosition.X,
                        (int)Global.Input.mousePosition.Y))
                {
                    TouchTriggers.Add(TouchGestures.Scrubbing);
                    SliderValue = slide(Global.Input.mousePosition, draw_offset);
                }
            }
        }
Esempio n. 2
0
 public void Update(ControlSet input, IEnumerable <int> range,
                    Vector2 draw_offset = default(Vector2))
 {
     if (input.HasEnumFlag(ControlSet.Buttons))
     {
         update_input();
     }
     foreach (int index in range)
     {
         Nodes[index].Update(this, input, draw_offset);
     }
 }
Esempio n. 3
0
 public void Update(ControlSet input,
                    Vector2 draw_offset = default(Vector2))
 {
     if (input.HasEnumFlag(ControlSet.Buttons))
     {
         update_input();
     }
     foreach (var node in Nodes)
     {
         node.Update(this, input, draw_offset);
     }
 }
Esempio n. 4
0
 private void UpdateButtons <T>(ControlSet input) where T : UINode
 {
     if (input.HasEnumFlag(ControlSet.Buttons))
     {
         foreach (Inputs key in this.ValidInputs)
         {
             if (Global.Input.triggered(key))
             {
                 Triggers.Add(key);
             }
         }
     }
 }
Esempio n. 5
0
        private void UpdateTouch <T>(
            UINodeSet <T> nodes,
            ControlSet input,
            Vector2 draw_offset) where T : UINode
        {
            if (input.HasEnumFlag(ControlSet.Touch))
            {
                if (Global.Input.gesture_rectangle(
                        TouchGestures.Tap, OnScreenBounds(draw_offset)))
                {
                    if (nodes != null)
                    {
                        nodes.TouchMove(this as T, TouchGestures.Tap);
                    }
                    TouchTriggers.Add(TouchGestures.Tap);
                }
                else if (Global.Input.gesture_rectangle(
                             TouchGestures.LongPress, OnScreenBounds(draw_offset)))
                {
                    if (nodes != null)
                    {
                        nodes.TouchMove(this as T, TouchGestures.LongPress);
                    }
                    TouchTriggers.Add(TouchGestures.LongPress);
                }
                else if (Global.Input.touch_rectangle(
                             Services.Input.InputStates.Pressed,
                             OnScreenBounds(draw_offset),
                             false))
                {
                    if (nodes != null)
                    {
                        nodes.TouchMove(this as T, TouchGestures.ShortPress);
                    }
                    mouse_click_graphic();
                }

                if (IsSlider)
                {
                    if (!Global.Input.touch_pressed(false))
                    {
                        TouchPressing = false;
                    }
                    else
                    {
                        bool pressed = OnScreenBounds(draw_offset).Contains(
                            (int)Global.Input.touchPressPosition.X,
                            (int)Global.Input.touchPressPosition.Y);
                        if (pressed && Global.Input.touch_triggered(false))
                        {
                            TouchPressing = true;
                        }

                        if (pressed && TouchPressing)
                        {
                            TouchTriggers.Add(TouchGestures.Scrubbing);
                            SliderValue = slide(Global.Input.touchPressPosition, draw_offset);
                        }
                    }
                }
            }
        }