English 中文(简体)
• 在XNA中采用提款方法确定案文2D?
原标题:Rotate a Texture2D with the Draw method in XNA?
  • 时间:2012-04-11 08:03:57
  •  标签:
  • c#
  • xna

I have a problem with rotating. I know that I can rotate a Texture2D object with the draw method.

我的目标是在180°之前轮换案文。 例如,如果我用头部底层的摄像机描绘一个人的情况,我就希望能够轮换,以便头部再次站在上。

此处为守则或轮换:

spriteBatch.Draw(Texture, Position, null, Color.White, MathHelper.Pi, new Vector2(), 1.0f, SpriteEffects.None, 0f);

The rotation works fine, but I have another problem: enter image description here

如果在轮任后,我增加0个职位的案文,则更看不到。

www.un.org/spanish/ecosoc 我如何轮换或可能反映这个目标,以便红点再次出现在最左上角?

最佳回答

http://msdn.microsoft.com/en-us/library/ff433989.aspx

public void Draw (
     Texture2D texture,
     Vector2 position,
     Nullable<Rectangle> sourceRectangle,
     Color color,
     float rotation,
     Vector2 origin,
     Vector2 scale,
     SpriteEffects effects,
     float layerDepth)

//Using:
var origin = new Vector2()
{
    X = texture.Width / 2,
    Y = texture.Height/ 2
};


spriteBatch.Draw(texture, Vector2.Zero, null, Color.White, MathHelper.Pi, origin, 1f, SpriteEffects.None, 0f)`
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签