Repeating Tile Background pygame
opengl, pygame, python
Solution
blit each brick onto the screen, but i think that would slow down the game.
Not as much as you probably think. bliting is very fast. Even if there were some sort of "fill" command, it would still amount to copying the image to a surface until the surface is covered.
If the background image is stationary, you can render to an off-screen surface when your program starts, and instead of erasing the screen by filling with a solid color, just blit the pre-rendered background instead.
Problem
Is there a feature similar to this in pygame? ``` screen.fill(pygame.image.load('brick.bmp').convert()) ``` I would like to fill the window (background) with an image to produce an effect similar to this: My only idea would be to blit each brick onto the screen, but i think that would slow down the game. Does anyone have an idea how to do this (and also provide some example code)? Heres a snippet of a method that works but goes slow ``` While True: for y in range(0,600,32): for x in range(0,800,32): screen.blit( self.img,(x,y)) ... pygame.display.flip() ```