[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] blit problem (bug?)



arg!

Dear pygame gods,

It still does not work as expected... I include a minimal example as 
attachment (the tile png should be in a separate tiles directory... or 
you can use any 64x64 tile)


First:
1/ I setup a display of resolution (1024x768) (confirmed with a print 
screen.get_size())
2/ I create an offscreen buffer of resolution (1024x832) (64 pixels 
higher than the first)
3/ I fill in the offscreen buffer with tiles
4/ I extract part of the offscreen buffer on the right part of the 
screen and part (the lowest 64 pixels) in the left part of the screen...

If i understand well, it should show up a line of tiles at the top of
the screen... but it remains blank... on the left part!!!!!!!!
-> corresponding to the screen.blit(buffer,(0,0),(0,768,512,64))

Why does this blit does not do what is expected?
Is it possible than my initial buffer was not initialized? Some clipping 
issues?
Or is there something i have
definitely missed?

Can somebody confirm the problem?

help!

Guillaume

PNG image

import pygame, pygame.font, os.path
import pygame.cursors
import pygame.transform
import pygame.image
import pygame.mixer
import pygame.event
import pygame.key
from pygame import *

def main():
    pygame.init()
    resolution = 1024, 768
    full=FULLSCREEN|DOUBLEBUF
    screen = pygame.display.set_mode(resolution,full)
    tile=pygame.image.load("tiles/tile_bluepool_64x64.png").convert()
    pygame.event.set_allowed([QUIT,KEYDOWN])
    buffer=pygame.Surface((1024,832)).convert()
    print screen.get_size()
    print buffer.get_size()
    for y in range(0,768,64):
	for x in range(0,1024,64):
		buffer.blit(tile,(x,y))
    for x in range(0,1024,64):
	buffer.blit(tile,(x,768))
    while 1:
    	screen.blit(buffer,(512,0),(0,0,512,64))
	screen.blit(buffer,(0,0),(0,768,512,64))
	pygame.display.flip()
        evt=pygame.event.get()
	if evt:
		break
main()