Ejemplo n.º 1
0
        /**
         * <summary>
         * Auxiliar method to know pressed mouse buttons
         * </summary>
         */
        public static bool IsKeyPressed(MouseState mouse, MouseEnum type)
        {
            bool res = false;

            switch (type)
            {
            case MouseEnum.LeftButton:
                res = mouse.LeftButton == ButtonState.Pressed;
                break;

            case MouseEnum.RightButton:
                res = mouse.RightButton == ButtonState.Pressed;
                break;

            case MouseEnum.MiddleButton:
                res = mouse.MiddleButton == ButtonState.Pressed;
                break;

            case MouseEnum.Wheel:
                res = mouse.Wheel != 0;
                break;

            default:
                break;
            }
            return(res);
        }
Ejemplo n.º 2
0
 /**
  * <summary>
  * Overrides the all key combinations for an action
  * </summary>
  */
 public void OverrideCombination(CommandEnum current, MouseEnum k)
 {
     if (bindings.ContainsKey(current))
     {
         bindings[current].Clear();
     }
     AddSingleCombination(current, k);
 }
Ejemplo n.º 3
0
        public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
        {
            base.onClick(mouseButton, _MousePosition);

            float var_Value = _MousePosition.X - this.Bounds.X;

            this.value = var_Value;
        }
Ejemplo n.º 4
0
 public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     base.onClick(mouseButton, _MousePosition);
     if (this.isChecked)
     {
         this.isChecked = false;
     }
     else
     {
         this.isChecked = true;
     }
 }
Ejemplo n.º 5
0
 public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     base.onClick(mouseButton, _MousePosition);
     if (mouseButton == MouseEnum.Left)
     {
         if (this.bodyColorPicker.IsInBounds(_MousePosition))
         {
             Component var_Top = this.bodyColorPicker.getTopComponent(_MousePosition);
             //this.characterComponent.ComponentColor = var_Top.ComponentColor;
             this.playerObject.Body.setColor(var_Top.ComponentColor);
         }
     }
 }
Ejemplo n.º 6
0
 public virtual void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     if (this.isActive)
     {
         this.IsFocused = true;
         if (!Input.Keyboard.KeyboardManager.keyboardFocus.Contains(this))
         {
             if (!allowMultipleFocus)
             {
                 Input.Keyboard.KeyboardManager.keyboardFocus.Clear();
             }
             Input.Keyboard.KeyboardManager.keyboardFocus.Add(this);
         }
     }
 }
Ejemplo n.º 7
0
 public virtual bool mouseClicked(MouseEnum mouseButtonClicked, Vector2 position)
 {
     if (position.X >= bounds.Left && position.X <= bounds.Right && position.Y >= bounds.Top && position.Y <= bounds.Bottom)
     {
         this.isPressed = true;
         return(true);
     }
     else
     {
         this.IsFocused = false;
         this.isPressed = false;
         Input.Keyboard.KeyboardManager.keyboardFocus.Remove(this);
         return(false);
     }
 }
Ejemplo n.º 8
0
 public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     base.onClick(mouseButton, _MousePosition);
     if (this.isDragAndDropAble && mouseButton.Equals(Input.Mouse.MouseEnum.MouseEnum.Left))
     {
         if (!this.isDraged)
         {
             this.onDrag(_MousePosition);
             this.ZIndex   = 100;
             this.isDraged = true;
         }
         else
         {
             if (this.onDrop(_MousePosition))
             {
                 this.ZIndex   = 0;
                 this.isDraged = false;
             }
         }
     }
 }
Ejemplo n.º 9
0
        public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
        {
            base.onClick(mouseButton, _MousePosition);
            if (this.lastSelected != null)
            {
                this.lastSelected.IsSelected = false;
                this.lastSelected            = null;
            }

            //TODO: Texture / Background anpassen!
            foreach (Component var_Component in this.Components)
            {
                // VLL auch mit isPressed ;) da mouse event öfters als einmal abegefeuert wird usw...
                if (_MousePosition.X >= var_Component.Bounds.Left && _MousePosition.X <= var_Component.Bounds.Right && _MousePosition.Y >= var_Component.Bounds.Top && _MousePosition.Y <= var_Component.Bounds.Bottom)
                {
                    this.lastSelected = var_Component;
                }
            }
            if (this.lastSelected != null)
            {
                this.lastSelected.IsSelected = true;
            }
        }
Ejemplo n.º 10
0
 public virtual void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     if (this.isActive)
     {
         this.IsFocused = true;
         if (!GameLibrary.Peripherals.KeyboardManager.keyboardFocus.Contains(this))
         {
             if (!allowMultipleFocus)
                 GameLibrary.Peripherals.KeyboardManager.keyboardFocus.Clear();
             GameLibrary.Peripherals.KeyboardManager.keyboardFocus.Add(this);
         }
     }
 }
Ejemplo n.º 11
0
 public virtual bool mouseReleased(MouseEnum mouseButtonReleased, Vector2 position)
 {
     if (position.X >= bounds.Left && position.X <= bounds.Right && position.Y >= bounds.Top && position.Y <= bounds.Bottom)
     {
         if (this.isPressed)
         {
             onClick(mouseButtonReleased, position);
             return true;
         }
     }
     else
     {
         this.IsFocused = false;
         this.isPressed = false;
         GameLibrary.Peripherals.KeyboardManager.keyboardFocus.Remove(this);
     }
     return false;
 }
Ejemplo n.º 12
0
 /**<summary>
  * Adds a new key combination. Shortcut for single keys
  * </summary>
  */
 private void AddSingleCombination(CommandEnum cmd, MouseEnum mouse)
 {
     AddCombination(cmd, null, new MouseEnum[] { mouse });
 }
Ejemplo n.º 13
0
 public void CreateMouseCombination(MouseEnum m)
 {
     keys.OverrideCombination(current, m);
     blocks[lastClicked].Text = keys.bindings[current][0].ToString();
     Cancel();
 }
Ejemplo n.º 14
0
 public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition)
 {
     base.onClick(mouseButton, _MousePosition);
     this.StartAction();
 }