|
|
发表于 2006-2-4 17:13:00
|
显示全部楼层
Re: 在DX里如何让图片旋转
Public Sub Draw(ByVal x As Single, ByVal y As Single, ByVal angle As Single)
Dim tMStart As Matrix = Matrix.Translation(-x, -y, 0) '移向原点的矩阵
Dim tMRota As Matrix = Matrix.RotationZ(angle) '旋转矩阵
Dim tMEnd As Matrix = Matrix.Translation(x, y, 0) '移回原来位置的矩阵
tMRota.Multiply(tMEnd)
tMStart.Multiply(tMRota)
mSprite.Transform = tMStart '设置矩阵
mVector.X = x + CenterX '中心点偏移
mVector.Y = y + CenterY
mSprite.Draw(mTex, New Vector3, mVector, &HFFFFFFFF)
End Sub
|
|