本文整理汇总了C#中SFML.Graphics.RectangleShape.GetLocalBounds方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleShape.GetLocalBounds方法的具体用法?C# RectangleShape.GetLocalBounds怎么用?C# RectangleShape.GetLocalBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.RectangleShape
的用法示例。
在下文中一共展示了RectangleShape.GetLocalBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateDrawable
protected override void UpdateDrawable() {
base.UpdateDrawable();
if (isCircle) {
var circle = new SFML.Graphics.CircleShape(radius);
circle.OutlineThickness = OutlineThickness;
circle.OutlineColor = OutlineColor.SFMLColor;
circle.FillColor = Color.SFMLColor;
circle.SetPointCount((uint)CirclePointCount);
SFMLDrawable = circle;
Width = (int)circle.GetLocalBounds().Width;
Height = (int)circle.GetLocalBounds().Height;
}
else {
if (isShape) {
var rect = new SFML.Graphics.RectangleShape(new Vector2f(rectWidth, rectHeight));
rect.OutlineColor = OutlineColor.SFMLColor;
rect.OutlineThickness = OutlineThickness;
rect.FillColor = Color.SFMLColor;
SFMLDrawable = rect;
Width = (int)rect.GetLocalBounds().Width;
Height = (int)rect.GetLocalBounds().Height;
}
else {
SFMLVertices.Clear();
float x1, y1, x2, y2, u1, v1, u2, v2, cx1, cy1, cx2, cy2;
cx1 = ClippingRegion.Left;
cy1 = ClippingRegion.Top;
cx2 = ClippingRegion.Right;
cy2 = ClippingRegion.Bottom;
x1 = Util.Max(0, cx1);
u1 = TextureLeft + x1;
if (FlippedX) {
u1 = TextureRegion.Width - u1 + TextureLeft + TextureRegion.Left;
}
y1 = Util.Max(0, cy1);
v1 = TextureTop + y1;
if (FlippedY) {
v1 = TextureRegion.Height - v1 + TextureTop + TextureRegion.Top;
}
x2 = Util.Min(TextureRegion.Right, cx2);
u2 = TextureLeft + x2;
if (FlippedX) {
u2 = TextureRegion.Width - u2 + TextureLeft + TextureRegion.Left;
}
y2 = Util.Min(TextureRegion.Bottom, cy2);
v2 = TextureTop + y2;
if (FlippedY) {
v2 = TextureRegion.Height - v2 + TextureTop + TextureRegion.Top;
}
SFMLVertices.Append(x1, y1, Color, u1, v1);
SFMLVertices.Append(x1, y2, Color, u1, v2);
SFMLVertices.Append(x2, y2, Color, u2, v2);
SFMLVertices.Append(x2, y1, Color, u2, v1);
}
}
}