[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] scaling the entire screen
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] scaling the entire screen
- From: "Patrick Mullen" <saluk64007@xxxxxxxxx>
- Date: Sat, 15 Mar 2008 14:35:12 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 15 Mar 2008 17:35:20 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=jHv5TUXP4fKz7/R9BNmYdjC5NcFjN7SV4OXfZ4m3QF4=; b=vKrwfWa7arDr67YYltKm3NL1iqg90HeELMxFSWJw0dx1ht/5Pu7r0DlfiETmMqv/s2nd5TKMaQU/ykYvYSNQYafko3SkgyUQHe0+7PUdg0SbZa29b63z8JAFeKgWNtD9poiqMczf0Kaqt1ynPwIv1N7ttuzoAVxxfCUOhLbKjMA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZxSGl1zgZ9ZPBjvgzPZirlI46tRTd6ZrdRgMfeWj57DTQ29ORfx9dQmx/cELHTMkzXFujLBbDXQ/MMwkpgyITo+A7xz8cIXWH1CJVavI8xkKmfwMCM+wRgb3ZqunZNxK6JPcvJJZyiCoTemZVVF6Pftzc69isoJzQKrYUskrFH4=
- In-reply-to: <563892.56460.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <563892.56460.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
This is very easy to do, thanks to the structure of pygame, blits and
surfaces. Here is a simple (untested) example:
Old way:
resolution = [320,240]
screen = pygame.display.set_mode(resolution)
while 1:
screen.blit(sprite,[5,5])
pygame.display.flip()
New way:
resolution = [640,480]
real_res = [320,240]
_screen = pygame.display.set_mode(resolution)
while 1:
screen.blit(sprite,[5,5])
#other plits
surf = pygame.transform.scale2x(screen)
_screen.blit(surf,[0,0])
pygame.display.flip()
And you have a nice doubly scaled screen. It will probably be slower
than just writing the game for the higher resolution though.