Mercurial > pygame-tutorial
changeset 2:ee28ba29d97e
Some tweak in the basic pygame program
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Thu, 14 Jun 2012 17:19:27 +0200 |
| parents | ae5f8de62b25 |
| children | e957564f94bb |
| files | .hgignore 000/002.py 000/003.py 000/004.py 000/005.py |
| diffstat | 5 files changed, 7 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Thu Jun 14 12:48:47 2012 +0200 +++ b/.hgignore Thu Jun 14 17:19:27 2012 +0200 @@ -7,6 +7,7 @@ bin/ lib/ include/ +share/ local *.egg-info *.DS_Store
--- a/000/002.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/002.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -21,6 +20,7 @@ def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT:
--- a/000/003.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/003.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,18 +12,17 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): """Load the image and display it in the middle of the screen.""" image = pygame.image.load('cup.png') screen.blit(image, (0, 0)) - pygame.display.update() def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT:
--- a/000/004.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/004.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -27,11 +26,11 @@ (screen_rect.height - image_rect.height) // 2, ) ) - pygame.display.update() def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT:
--- a/000/005.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/005.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -22,16 +21,13 @@ image.set_colorkey((0xff, 0x00, 0xff)) screen_rect = screen.get_rect() image_rect = image.get_rect() - screen.blit(image, ( - (screen_rect.width - image_rect.width) // 2, - (screen_rect.height - image_rect.height) // 2, - ) - ) - pygame.display.update() + image_rect.center = screen_rect.center + screen.blit(image, image_rect) def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT:
