Texturing Brushes in GDI+

Started by
1 comment, last by luridcortex 20 years ago
Sup all, im working with GDI+ to try and make a simple 2D game. Im using textured brushes for sprites, but GDI+ keeps wanting to tile them. For instance if you fill a rectangle with a image brush and then move it about the screen the image wont move with the rectangle, it will just scroll down and tile the image. Heres my code:

// void Render ( )
//
// Render the sprite to the screen
void CSprite::Render ( )
{
	// Create graphics object
	Graphics g( pong.hMemDC );
	
	wstring ws ( mImg.begin(), mImg.end() ); 
	
	// Load the image
	Image image( ws.c_str() );

	// create a textured brush
	TextureBrush tBrush( ℑ );

	// Draw and fill the rectangle
	g.FillRectangle(&tBrush, mX, mY, mWidth, mHeight);
}
  
Anyone know any ways around this? [edited by - luridcortex on April 4, 2004 12:17:10 AM]
Advertisement
Why are you using a texture brush? The textured brush automatically tiles (that''s its purpose). If I understand what you are trying to do correctly, using Graphics::DrawImage() is what you want.

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
oh cripes!

yeah that would make a bit more sense wouldnt it...

thanks!

This topic is closed to new replies.

Advertisement