Repeat Sprite across window?

For a game over screen I would like to repeat one sprite over the background. Does anyone know of a way to do this other than loading the sprite numerous times over the background? The idea is to fill the window with lots of this one little sprite. Here's some code that I have so far.

1
2
3
4
5
6
typedef struct Poppies
{
	int x, y;
	HBITMAP bitmap;
} Poppies;
Poppies TestPoppies;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void drawPoppies(Poppies thePoppies)
{
	/*static*/HBITMAP originalBitMap;
	
	//static int cxClient, cyClient;
	

	originalBitMap = (HBITMAP)SelectObject(bitmapHDC,thePoppies.bitmap);
	
	
	/*for (thePoppies.y = 0 ; thePoppies.y < cyClient ; thePoppies.y += thePoppies.x+32)
	for (thePoppies.x = 0 ; thePoppies.x < cxClient ; thePoppies.x += thePoppies.y+32)
	{
	BitBlt(backHDC,thePoppies.x, thePoppies.y,thePoppies.x+32,thePoppies.y+32,bitmapHDC,0,0,SRCCOPY);
	}*/
	BitBlt(backHDC,thePoppies.x,thePoppies.y,thePoppies.x+32,thePoppies.y+32,bitmapHDC,0,0,SRCCOPY);
	SelectObject(bitmapHDC,originalBitMap);
}


TestPoppies.bitmap = LoadABitmap("poppy.bmp");

Have attempted numerous methods from the Charles Petzold Programming Windows book but can't seem to get this to work. Anyone know how to do this?
Last edited on
Topic archived. No new replies allowed.