本文整理汇总了C#中Microsoft.Xna.Framework.Rectangle.FormatToString方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.FormatToString方法的具体用法?C# Rectangle.FormatToString怎么用?C# Rectangle.FormatToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Rectangle
的用法示例。
在下文中一共展示了Rectangle.FormatToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRender
protected override void DoRender(
Moment now,
GraphicsDevice graphicsDevice,
ISpriteBatch spriteBatch,
TextureContent content,
HolofunkView view,
Transform parentTransform,
int depth)
{
// no texture = no-op
if (m_texture == null) {
return;
}
int left = -(int)((float)m_texture.Width * m_origin.X);
int top = -(int)((float)m_texture.Height * m_origin.Y);
Rectangle rect = new Rectangle(left, top, m_texture.Width, m_texture.Height);
Transform combinedTransform = parentTransform.CombineWith(LocalTransform);
Rectangle transformedRect = rect * combinedTransform;
Spam.Graphics.WriteLine(new string(' ', depth * 4) + Label + ": parentTransform " + parentTransform + ", localTransform " + LocalTransform + ", combinedTransform " + combinedTransform + "; start rect " + rect.FormatToString() + "; transformedRect " + transformedRect.FormatToString());
Texture2D texture = m_texture;
SpriteEffects effects = SpriteEffects.None;
if (view == HolofunkView.Secondary) {
if ((SecondaryViewOption & SecondaryViewOption.TextureMirrored) != 0) {
effects = SpriteEffects.FlipHorizontally;
}
if ((SecondaryViewOption & SecondaryViewOption.PositionMirrored) != 0) {
// need to flip transformedRect around center of viewport
int newLeft = (int)spriteBatch.Viewport.X - transformedRect.Right;
transformedRect = new Rectangle(newLeft, transformedRect.Y, transformedRect.Width, transformedRect.Height);
}
if ((SecondaryViewOption & SecondaryViewOption.SecondTexture) != 0) {
HoloDebug.Assert(m_secondaryTexture != null);
texture = m_secondaryTexture;
}
}
Color color = m_color;
if (view == HolofunkView.Secondary && m_secondaryColor.HasValue) {
color = m_secondaryColor.Value;
}
// Use NonPremultiplied, as our sprite textures are not premultiplied
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
spriteBatch.Draw(
texture,
transformedRect,
null,
color,
0,
m_origin,
effects,
0);
spriteBatch.End();
}