Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

luridcortex

Texturing Brushes in GDI+

This topic is 5191 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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( &image );

	// 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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!