# HG changeset patch # User sam # Date 1723045612 -25200 # Node ID 196bfc6af8e07cca3b6bd57730ab8e67e776f438 # Parent 5a898b18a58a04c00138d96d75308c06639a1cb8 fix: flip y axis on normalize mouse coordinates diff -r 5a898b18a58a -r 196bfc6af8e0 semicongine/input.nim --- a/semicongine/input.nim Wed Aug 07 22:22:16 2024 +0700 +++ b/semicongine/input.nim Wed Aug 07 22:46:52 2024 +0700 @@ -87,9 +87,9 @@ proc mouseWasReleased*(button: MouseButton): bool = button in input.mouseWasReleased proc mouseReleasedButtons*(): set[MouseButton] = input.mouseWasReleased proc mousePositionPixel*(): Vec2i = input.mousePosition -proc mousePosition*(size: (int, int)): Vec2f = - result.x = (input.mousePosition.x.float32 / float32(size[0])) * 2.0 - 1.0 - result.y = (input.mousePosition.y.float32 / float32(size[1])) * 2.0 - 1.0 +proc mousePosition*(): Vec2f = + result = input.mousePosition.f32 / vulkan.window.size().f32 * 2.0'f32 - 1.0'f32 + result.y = result.y * -1 proc mouseMove*(): Vec2i = input.mouseMove proc mouseWheel*(): float32 = input.mouseWheel proc windowWasResized*(): auto = input.windowWasResized