Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen displays only in top left corner of window

Tags:

python

pygame

I'm starting to explore Python and Pygame, however I am running into a problem. Everything I draw to the screen is only displayed in the top left quarter of the window. I thought it was my code but any demo programs I tried also display the same way.

Demo code from thenewboston on youtube

import pygame, sys
from pygame.locals import *

pygame.init()

screen = pygame.display.set_mode((640,360),0,32)

background = pygame.image.load("Background.jpg").convert()
mouse_c = pygame.image.load("ball.png").convert_alpha()

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

    screen.blit(background, (0,0))

    x,y = pygame.mouse.get_pos()
    x -= mouse_c.get_width()/2
    y -= mouse_c.get_height()/2

    screen.blit(mouse_c, (x,y))

    pygame.display.update()

In the video his displays correctly and mine looks like this screenshot of game rendering only in the top left quarter of the screen

Using:

  • Python 2.7.4 32 bit
  • pygame 1.9.1 32 bit
  • mac 10.8.3 64 bit on macbook pro retina

I think either it has to do with the retina display or I installed something wrong. Any help would be appreciated.

like image 631
Sam Avatar asked May 03 '13 22:05

Sam


1 Answers

The problem is, in fact, with the resolution of the retina screen. In order to get pygame to work correctly, download setresx and use it to set your resolution to any setting without HiDPI.

like image 150
user2512924 Avatar answered Sep 20 '22 05:09

user2512924