public static void UpdateRectangleSelection(int mouseX, int mouseY) { if (clickingLeft) { float diffX = Math.Abs(mouseClickX - mouseX); float diffY = Math.Abs(mouseClickY - mouseY); if (diffX + diffY > 5 && !rectangleSelecting) { rectangleSelecting = true; selectionLineA.Visible = true; selectionLineB.Visible = true; selectionLineC.Visible = true; selectionLineD.Visible = true; } if (rectangleSelecting) { float clickXRel = ((float)mouseClickX / Program.GLControl.ClientSize.Width); clickXRel = (clickXRel - 0.5f) * 2; float clickYRel = ((float)mouseClickY / Program.GLControl.ClientSize.Height); clickYRel = (clickYRel - 0.5f) * 2; float mouseXRel = ((float)mouseX / Program.GLControl.ClientSize.Width); mouseXRel = (mouseXRel - 0.5f) * 2; float mouseYRel = ((float)mouseY / Program.GLControl.ClientSize.Height); mouseYRel = (mouseYRel - 0.5f) * 2; selectionLineA.Start = new Vector2(clickXRel, clickYRel); selectionLineA.End = new Vector2(mouseXRel, clickYRel); selectionLineB.Start = new Vector2(mouseXRel, clickYRel); selectionLineB.End = new Vector2(mouseXRel, mouseYRel); selectionLineC.Start = new Vector2(mouseXRel, mouseYRel); selectionLineC.End = new Vector2(clickXRel, mouseYRel); selectionLineD.Start = new Vector2(clickXRel, mouseYRel); selectionLineD.End = new Vector2(clickXRel, clickYRel); Renderer.Update2DMeshData(); Renderer.Invalidate(); } } }