本文整理汇总了C#中Microsoft.Xna.Framework.Rectangle.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.Intersect方法的具体用法?C# Rectangle.Intersect怎么用?C# Rectangle.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Rectangle
的用法示例。
在下文中一共展示了Rectangle.Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(GameTime time, Matrix parent, Rectangle scissor)
{
Matrix transform = this.Transform * parent;
Rectangle newScissor = scissor;
if (this.EnableScissor)
newScissor = scissor.Intersect(RectangleExtensions.Create(Vector2.Transform(Vector2.Zero, transform), Vector2.Transform(this.Size, transform)));
if (newScissor.Width > 0 && newScissor.Height > 0)
{
if (this.EnableScissor)
{
this.renderer.Batch.End();
this.renderer.Batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.renderer.RasterizerState, null, Matrix.Identity);
this.main.GraphicsDevice.ScissorRectangle = newScissor;
}
this.draw(time, parent, transform);
foreach (UIComponent child in this.Children)
{
if (child.Visible)
{
if (this.main.GraphicsDevice.ScissorRectangle != newScissor || child.requiresNewBatch)
{
this.renderer.Batch.End();
this.renderer.Batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.renderer.RasterizerState, null, Matrix.Identity);
this.main.GraphicsDevice.ScissorRectangle = newScissor;
}
child.Draw(time, transform, newScissor);
}
}
}
if (this.EnableScissor)
{
// Restore original scissor
this.renderer.Batch.End();
this.renderer.Batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.renderer.RasterizerState, null, Matrix.Identity);
this.main.GraphicsDevice.ScissorRectangle = scissor;
}
}