本文整理汇总了C#中DeltaEngine.Datatypes.Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Rectangle类的具体用法?C# Rectangle怎么用?C# Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于DeltaEngine.Datatypes命名空间,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdjustViewport
private void AdjustViewport(Vector2D point)
{
if (viewport == Rectangle.Zero)
viewport = new Rectangle(point, Size.Zero);
else
UpdateEdges(point);
}
示例2: MouseHoldTrigger
public MouseHoldTrigger(Rectangle holdArea, float holdTime = DefaultHoldTime,
MouseButton button = MouseButton.Left)
{
HoldArea = holdArea;
HoldTime = holdTime;
Button = button;
}
示例3: DrawRectangle
public override void DrawRectangle(Rectangle area)
{
Rectangle pixelRect = device.Screen.ToPixelSpace(area);
var sharpRect = new RectangleF(pixelRect.Left, pixelRect.Top, pixelRect.Right,
pixelRect.Bottom);
device.RenderTarget.FillRectangle(sharpRect, solidColorBrush);
}
示例4: ItemEffect
public ItemEffect(Material material, Rectangle drawArea, float duration)
: base(material, drawArea, duration)
{
RenderLayer = (int)RenderLayers.Items;
Add(new Damage { Interval = 0.25f });
Start<DoDamage>();
}
示例5: Bottom
public void Bottom()
{
var rect = new Rectangle(1, 2, 10, 20) { Bottom = 23 };
Assert.AreEqual(3, rect.Top);
Assert.AreEqual(23, rect.Bottom);
Assert.AreEqual(20, rect.Height);
}
示例6: MoveSprite
private void MoveSprite()
{
float percentage = elapsed / timeout;
Point topLeft = Point.Lerp(startDrawArea.TopLeft, endDrawArea.TopLeft, percentage);
Size size = Size.Lerp(startDrawArea.Size, endDrawArea.Size, percentage);
DrawArea = new Rectangle(topLeft, size);
}
示例7: CheckBounds
private bool CheckBounds(Rectangle view)
{
if (view.Left > DrawArea.Left) return false;
if (view.Right < DrawArea.Right) return false;
if (DrawArea.Top < 0) return false;
return view.Top + 0.05f <= DrawArea.Center.Y;
}
示例8: Clip
public void Clip(Rectangle clippingBounds)
{
var line = new ClippedLine(StartPoint, EndPoint, clippingBounds);
StartPoint = line.StartPoint;
EndPoint = line.EndPoint;
IsVisible = line.IsVisible;
}
示例9: Label
internal Label(Theme theme, Material material, Rectangle drawArea)
: base(theme, material, drawArea)
{
var fontText = new FontText(theme.Font, "", GetFontTextDrawArea());
Add(fontText);
AddChild(fontText);
}
示例10: Polygon2D
public Polygon2D(Rectangle drawArea, Color color)
: base(drawArea)
{
Color = color;
Add(new List<Vector2D>());
OnDraw<DrawPolygon2D>();
}
示例11: CreateFromRectangle
public void CreateFromRectangle(Type resolver)
{
var halfScreenRect = new Rectangle(Point.Zero, Size.Half);
Rect box = null;
Start(resolver, (Renderer r) => r.Add(box = new Rect(halfScreenRect, Color.Red)),
() => Assert.AreEqual(Color.Red, box.Color));
}
示例12: RecalculateUV
private static void RecalculateUV(Matrix matrix, Sprite entity, float angle)
{
var yScaled = RecalculateYCoordinate(matrix, angle);
var uv = new Rectangle(entity.UV.Left,
0.25f - ((1 - entity.UV.Height)) * yScaled, entity.UV.Width,
entity.UV.Height);
entity.UV = uv;
}
示例13: DeriveExtremities
private void DeriveExtremities()
{
float width = viewport.Width / (1 + 2 * Buffer);
float left = viewport.Center.X - width / 2;
float height = viewport.Height / (1 + 2 * Buffer);
float top = viewport.Center.Y - height / 2;
extremities = new Rectangle(left, top, width, height);
}
示例14: Slider
public Slider(Theme theme, Rectangle drawArea)
: base(theme, theme.Slider, drawArea)
{
var data = new Data { MinValue = 0, Value = 100, MaxValue = 100 };
Add(data);
Add(new Picture(theme, theme.SliderPointer, Rectangle.Unused));
AddChild(Pointer);
}
示例15: ToQuadratic
private static Vector2D ToQuadratic(Vector2D point, Rectangle viewport, Rectangle drawArea)
{
float borderWidth = viewport.Width * Graph.Border;
float borderHeight = viewport.Height * Graph.Border;
float x = (point.X - viewport.Left + borderWidth) / (viewport.Width + 2 * borderWidth);
float y = (point.Y - viewport.Top + borderHeight) / (viewport.Height + 2 * borderHeight);
return new Vector2D(drawArea.Left + x * drawArea.Width, drawArea.Bottom - y * drawArea.Height);
}