From d97d9a9e706d498ee22f89fb10149fa79296a074 Mon Sep 17 00:00:00 2001
From: NiseVoid <nisevoid@gmail.com>
Date: Mon, 10 Jul 2023 02:10:46 +0200
Subject: [PATCH] Fix cursor position

---
 src/input.rs | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/input.rs b/src/input.rs
index 13947a0..77f1ab9 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -5,7 +5,6 @@ use bevy::{
         ButtonState,
     },
     prelude::*,
-    window::PrimaryWindow,
 };
 
 use crate::{
@@ -15,17 +14,6 @@ use crate::{
 };
 
 pub(crate) fn process_events(world: &mut World) {
-    // TODO: Rewrite an process events per window.
-    let window_size = if let Ok(window) = world
-        .query_filtered::<&Window, With<PrimaryWindow>>()
-        .get_single(world)
-    {
-        Vec2::new(window.width(), window.height())
-    } else {
-        log::warn!("Couldn't find primary window!");
-        return;
-    };
-
     let mut input_events = Vec::new();
 
     query_world::<
@@ -62,10 +50,7 @@ pub(crate) fn process_events(world: &mut World) {
                 .last()
             {
                 // Currently, we can only handle a single MouseMoved event at a time so everything but the last needs to be skipped
-                input_events.push(InputEvent::MouseMoved((
-                    event.position.x,
-                    window_size.y - event.position.y,
-                )));
+                input_events.push(InputEvent::MouseMoved(event.position.into()));
             }
 
             for event in custom_event_mouse_button.0.iter(&mouse_button_input_events) {
-- 
GitLab