Jump to content
  • Advertisement

Archived

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

r3alityc0d3r

2d Sprites Slowdown

This topic is 5479 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

I am making a tetris clone that uses ID3DXSPRITE for the blocks. The problem is that when a few blocks are on the screen it slows down tremendously. I can''t seem to figure out why. My collision detection is as streamlined as i can get it. Here is some of my code for the sprites... void graphics::DrawBlueBlock(int x, int y ) { D3DXCreateSprite(g_pD3DDevice, &pSprite); D3DXVECTOR2 vScaling( 1.0, 1.0 ); D3DXVECTOR2 vRotationCenter( 0.0, 0.0 ); D3DXVECTOR2 vTranslation( (float)x, (float)y ); pSprite->Draw( tetris_texture, &BluBlkRect, &vScaling, &vRotationCenter, 0.0f, &vTranslation, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f) ); } I release the sprite when the program closes. I have the draw statements all between the sprite->Begin() and sprite->End() lines. I just can''t seem to figure out what is slowing it down. Pleeaase help. r3alityc0d3r icq: 252463839 r3alityc0d3r@hotmail.com "I am the Architect. I created the Matrix...Your life is the sum of a remainder of an unbalanced equation inherent to the programming of the Matrix. Which has led you, inexorably... here." Great Architect - Matrix Reloaded

Share this post


Link to post
Share on other sites
Advertisement
Just a question for you. Is that D3DXCreateSprite() call really required to be inside your draw function? Being an OpenGL man I''m not too familiar with DirectX, but it looks to me like that function could be called outside of the draw function (perhaps in some initialization phase), and the pre-initialized pSprite pointer could then be used in the draw function as needed. If D3DXCreateSprite() is a slow function, this could be a part of your problem.

If I''m completely wrong, please don''t yell at me too loudly.

Josh
vertexnormal AT linuxmail DOT org


Check out Golem at:
My cheapass website

Share this post


Link to post
Share on other sites
(bows down) you are a geneius That made my game playable! also now it doesnt crash my computer after starting it 20 times. I can''t beleive i didn''t notice that before. BTW - your game looks awesome. Can''t wait to play the demo.

r3alityc0d3r
icq: 252463839
r3alityc0d3r@hotmail.com
"I am the Architect. I created the Matrix...Your life is the sum of a remainder of an unbalanced equation inherent to the programming of the Matrix. Which has led you, inexorably... here." Great Architect - Matrix Reloaded

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!