diff options
Diffstat (limited to 'src/helper.py')
-rw-r--r-- | src/helper.py | 18 |
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)) |