From ed411f53bdcf8d455f9e6ca769693aa84dc8372f Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 5 May 2024 22:18:10 +0100 Subject: cursor: move to a hyprland impl This moves wlr_cursor to a completely new impl mostly under CPointerManager Also adds beginSimple to OpenGL for simple render passes (e.g. cursor) --- src/helpers/Vector2D.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/helpers/Vector2D.cpp') diff --git a/src/helpers/Vector2D.cpp b/src/helpers/Vector2D.cpp index c74da0b1..6f96d686 100644 --- a/src/helpers/Vector2D.cpp +++ b/src/helpers/Vector2D.cpp @@ -42,9 +42,11 @@ Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) const { } double Vector2D::distance(const Vector2D& other) const { - double dx = x - other.x; - double dy = y - other.y; - return std::sqrt(dx * dx + dy * dy); + return std::sqrt(distanceSq(other)); +} + +double Vector2D::distanceSq(const Vector2D& other) const { + return (x - other.x) * (x - other.x) + (y - other.y) * (y - other.y); } double Vector2D::size() const { -- cgit v1.2.3