-
-
Notifications
You must be signed in to change notification settings - Fork 216
Open
Labels
Description
Environment:
You can get some of this info from the text that pops up in the console when you run a pygame program.
Windows 10
pygame-ce 2.3.0.dev1 (SDL 2.26.4, Python 3.11.0)
Current behavior:
Unable to position the mouse to the right most column or bottom row of pixels when in FULLSCREEN mode using the SCALED flag with certain resolutions.
Expected behavior:
The scaled mouse position should accurately reflect the currently highlighted pixel and be able to be positioned on all possible pixels no matter the selected resolution.
Steps to reproduce:
- Run the below code
- Attempt to move the mouse to the right most column or bottom most row of pixels.
import pygame
pygame.init()
# create a window
screen_size = (560, 315)
# screen_size = (512, 288)
screen = pygame.display.set_mode(screen_size, flags = pygame.FULLSCREEN | pygame.SCALED)
# screen = pygame.display.set_mode(screen_size, flags = pygame.SCALED)
pygame.display.set_caption("pygame mouse test")
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
running = False
# clear screen
screen.fill('black')
# get mouse pos
mouse_pos = pygame.mouse.get_pos()
print(mouse_pos)
# draw mouse pos
pygame.draw.rect(screen, 'red', pygame.Rect(mouse_pos, (1, 1)))
# update display
pygame.display.flip()
# tick the clock
clock.tick()
pygame.quit()