Skip to main content
GameDev.net gamedev.net
🔒 Locked

[slimDX] rotation and scaling sprites

Started by id0001 May 27, 2008 at 2:47 AM 3 replies 2.9k views
Original Post
id0001
id0001
I am trying to rotate and scale sprites in an slimDX application but I have no clue on how to do it. I tried to use the Sprite.Tranform property but I couldn't figure out how it worked because I have never worked with these transformations before. Can anyone point me in the right direction on how to rotate and scale sprites in slimDX. Thanks, ID
Mike.Popoloski
Mike.Popoloski
Simply create a matrix describing the kind of transformation you want, and then use it to set the sprite's Transform property. If you don't know what matrix transformations are, you probably need to go study 3D math some more before you'll be ready to tackle a 3D API.
Mike Popoloski | Journal | SlimDX
id0001
id0001
well I know what matrix transformations are but I have never really worked with it.

My rotation problem is this:

I use sprite.Transform = Matrix.RotationZ(3);, but the rotationcenter is in the upperleft corner and I cant figure out how I can change this.
MJP
MJP
Native D3D has a function called D3DXMatrixTransformation2D that allows you to specify scaling and rotation factors with a center point for both. I'm sure there's an equivalent function in SlimDX.
Promit
Promit
There sure is: Matrix.Transformation2D.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.