Mercurial > games > semicongine
changeset 1308:196bfc6af8e0
fix: flip y axis on normalize mouse coordinates
author | sam <sam@basx.dev> |
---|---|
date | Wed, 07 Aug 2024 22:46:52 +0700 |
parents | 5a898b18a58a |
children | 53a8766292a7 |
files | semicongine/input.nim |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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