Reputation: 1354
My display's native resolution is 320x480 but pygame's pygame.display.list_modes()
doesn't include it. When I try to set it, I get 640x480 instead, which is in the list. How can I use the native resolution?
320x480 is also the resolution the framebuffer is in when my program starts and pygame correctly detects that, so a way to get pygame to just continue using the existing mode would solve the problem too.
import pygame
pygame.init()
print(pygame.display.list_modes())
# Prints [(1600, 1200), (1280, 1024), (1024, 1024), (1280, 960), (1152, 864), (1024, 768), (800, 600), (768, 576), (640, 480)]
width = pygame.display.Info().current_w
height = pygame.display.Info().current_h
print(width, height)
# Correctly prints 320 480
surface = pygame.display.set_mode((width, height), pygame.FULLSCREEN)
surface.fill((255, 0, 0))
pygame.display.update()
# Uses 640x480 letterboxed twice to become really small.
The 320x480 mode is set in /boot/config.txt as a custom mode using
hdmi_group=2
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
display_hdmi_rotate 1
Upvotes: 0
Views: 281
Reputation: 1354
Add the mode to /etc/fb.modes like this:
mode "320x480-60"
geometry 320 480 320 480 8
endmode
Upvotes: 1