summaryrefslogtreecommitdiff
path: root/src/helper.py
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-09-03 14:39:50 +0200
committerRaindropsSys <contact@minteck.org>2023-09-03 14:39:50 +0200
commit153d21ace9801ac665e2d7f99c967147d1214f29 (patch)
treef363dccf520fbc2c1670d2308b73294fa9ab5676 /src/helper.py
parent6a20ab31ef4d9f6bb0e008b9f1b8d3fbeb6bd956 (diff)
downloadblocks-153d21ace9801ac665e2d7f99c967147d1214f29.tar.gz
blocks-153d21ace9801ac665e2d7f99c967147d1214f29.tar.bz2
blocks-153d21ace9801ac665e2d7f99c967147d1214f29.zip
Updated 16 files and added 5 files (automated)
Diffstat (limited to 'src/helper.py')
-rw-r--r--src/helper.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/helper.py b/src/helper.py
index 46f831a..2f4e53e 100644
--- a/src/helper.py
+++ b/src/helper.py
@@ -70,4 +70,20 @@ def get_chunk_regions(chunks):
"range": (16 * x, 16 * y, 15 + 16 * x, 15 + 16 * y)
})
- return data \ No newline at end of file
+ return data
+
+def get_real_mouse(screen):
+ width = screen.get_size()[0]
+ height = width / (16/9)
+
+ if width > screen.get_size()[0] or height > screen.get_size()[1]:
+ height = screen.get_size()[1]
+ width = height * (16/9)
+
+ offset_x = screen.get_size()[0] / 2 - width / 2
+ offset_y = screen.get_size()[1] / 2 - height / 2
+ scaling = ((width / 1280) + (height / 720)) / 2
+
+ pos = pygame.mouse.get_pos()
+
+ return (int((pos[0] - offset_x) / scaling), int((pos[1] - offset_y) / scaling))