protected override bool IsInside(Vector2 position) { if (grid.Enabled) { if (EonMathsHelper.IsInsideOf(bounds, position)) { hovered.Enable(); bool found = false; int idx = 0; while (idx < cells.Count && !found) { if (EonMathsHelper.IsInsideOf(cells[idx].Bounds, position)) { found = true; hovered.Offset = cells[idx].Bounds.Location.ToVector2(); tempIndex = idx; } else { idx++; } } return(true); } else { hovered.Disable(); } } return(false); }
/// <summary> /// Used to set the sensitivity of the Mouse. /// </summary> /// <param name="value">The value to set the sensitivity to.</param> public void SetMouseSensitivity(float value) { if (sensitivity != value) { sensitivity = EonMathsHelper.Clamp(sensitivity, MinSensitivity, MaxSensitivity); } }
public void ChangeControllerSensitivity(float amount) { if (controllerSensitivity != amount) { controllerSensitivity = EonMathsHelper.Clamp(controllerSensitivity, 0.1f, 0.9f); } }
void txtVolume_TextChanged(object sender, System.EventArgs e) { float f = 0.0f; if (float.TryParse(txtVolume.Text, out f)) { f = EonMathsHelper.Clamp(f, 0.1f, 1.0f); txtVolume.Text = "" + f; } else { txtVolume.Text = "" + 0.1f; } }
protected override bool IsInside(Vector2 position) { if (Enabled) { bool isInside = EonMathsHelper.IsInsideOf(bounds, position); if (isInside) { active = true; if (onActive != null) { onActive(this); } Vector2 move = Vector2.Zero; float speed = 5; if (position.X <= 15) { move.X -= speed; } else if (position.X >= bounds.Width - 15) { move.X += speed; } if (position.Y <= 15) { move.Y -= speed; } else if (position.Y >= bounds.Height - 15) { move.Y += speed; } CameraManager2D.CurrentCamera.Move(move); Vector2 p = Vector2.Transform(position, Matrix.Invert(CameraManager2D.CurrentCamera.ViewMatrix)); bool found = false; tileIndex = 0; while (tileIndex < cells.Count && !found) { if (EonMathsHelper.IsInsideOf(cells[tileIndex].Bounds, p)) { found = true; } else { tileIndex++; } } if (tileIndex >= cells.Count) { tileIndex--; } } return(isInside); } return(false); }