• Popular Now

• 14
• 12
• 9
• 10
• 13

Archived

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

ID3DXSprite scaling and rotation

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

Recommended Posts

Can ''ID3DXSprite''s be rotated or scaled, or should I use a textured quad and do it manually?

Share on other sites
yeah dont use any of the ID3DX classes, they are way too slow, and you dont learn anything when you just use their classes.
so yeah write your own, then you will have complete control over them.

Share on other sites
you can scale rotate and translate ID3DXSprite using the SetTransform method (that takes a transformation matrix) before calling draw.

I've found the D3DXSprite class in the summer update of DirectX 9 to be more than adequate for the windowing toolkit I'm making, plus it's been very easy to use. Just make sure you put all your draw commands within a call to begin and end.

If you're planning on mixing text and sprites you can actually use the D3DXFont class with D3DXSprite which uses all the batching that comes with D3DXSprite. Just watch out for the transform matrix as it took me ages to work out why all of my text was being translated to the wrong position.

Mrs Kensington http://www.mikeditum.co.uk

[edited by - mrs kensington on March 29, 2004 11:55:41 AM]

Share on other sites
quote:
Original post by hlivingstone
yeah dont use any of the ID3DX classes, they are way too slow, and you dont learn anything when you just use their classes.
so yeah write your own, then you will have complete control over them.

Too slow for what? Have you actually used them?

Why use DirectX? You won''t learn anything if you use an API. So if you want to write a game you''re really better off writing your own operating system and graphics API, then you have complete control. Well, almost. I guess you''d have to design your own hardware too.

Alternately, if you just want to write a game, you can use the quality tools that are available (like D3DX) and get it done reasonably quickly.

Stay Casual,

Ken
Drunken Hyena

Share on other sites
Hey, you''re that guy with all the tutorials...

Actually, I''ve noticed that kind of sarcasm surfaces fairly regularly If I can scale and rotate my sprite, then ID3DXSprite should be adequate. I''ll probably work more on vertices, textures, etc, when I move on to 3D.

Share on other sites
Oh yeah, I forgot to ask, does ID3DXSprite support alpha blending as well as a colour key?

Share on other sites
quote:
Original post by red_sodium
Oh yeah, I forgot to ask, does ID3DXSprite support alpha blending as well as a colour key?

Yep it does! just pass D3DXSPRITE_ALPHABLEND in your begin call... as in like this...

sprite->Begin(D3DXSPRITE_ALPHABLEND);

The MSDN page for ID3DXSprite is here and is very useful.

Mrs Kensington http://www.mikeditum.co.uk

Share on other sites
pass D3DXSPRITE_ALPHABLEND to the ID3DXSprite::Begin method

Share on other sites
quote:
Original post by red_sodium
Oh yeah, I forgot to ask, does ID3DXSprite support alpha blending as well as a colour key?

As others have said, use the alphablending flag.
DirectX 8 and 9 don''t do color keying, when you load a texture with D3DXCreateTextureFromFileEx you can specify a color key, it then creates an alpha channel in your texture. After that it uses alpha blending/testing, not the color key itself.