/** * <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); }
/** * <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); }
public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition) { base.onClick(mouseButton, _MousePosition); float var_Value = _MousePosition.X - this.Bounds.X; this.value = var_Value; }
public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition) { base.onClick(mouseButton, _MousePosition); if (this.isChecked) { this.isChecked = false; } else { this.isChecked = true; } }
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); } } }
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); } } }
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); } }
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; } } } }
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; } }
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); } } }
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; }
/**<summary> * Adds a new key combination. Shortcut for single keys * </summary> */ private void AddSingleCombination(CommandEnum cmd, MouseEnum mouse) { AddCombination(cmd, null, new MouseEnum[] { mouse }); }
public void CreateMouseCombination(MouseEnum m) { keys.OverrideCombination(current, m); blocks[lastClicked].Text = keys.bindings[current][0].ToString(); Cancel(); }
public override void onClick(MouseEnum mouseButton, Vector2 _MousePosition) { base.onClick(mouseButton, _MousePosition); this.StartAction(); }