A filled solid color 2D rectangle to be rendered.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Entities DrawableEntity
DeltaEngine.Rendering2D Entity2D
DeltaEngine.Rendering2D.Shapes Polygon2D
DeltaEngine.Rendering2D.Shapes FilledRect
DeltaEngine.Rendering2D.Graphs Graph
DeltaEngine.Scenes.Controls PercentageBar
DeltaEngine.Scenes.Terminal Console
GameOfLife Cell
Snake Chunk
TilDeath ColorRectangle
TinyPlatformer Actor
Namespace: DeltaEngine.Rendering2D.Shapes
Assembly: DeltaEngine.Rendering2D.Shapes (in DeltaEngine.Rendering2D.Shapes.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The FilledRect type exposes the following members.
Constructors
Name | Description | |
---|---|---|
FilledRect | Initializes a new instance of the FilledRect class |
Methods
Extension Methods
Name | Description | |
---|---|---|
AffixToPhysics | (Defined by Entity2DPhysicsExtensions.) | |
StartBouncingOffScreenEdges | (Defined by Entity2DExtensions.) | |
StartFalling | (Defined by Entity2DExtensions.) | |
StartMoving | (Defined by Entity2DExtensions.) | |
StartRotating | (Defined by Entity2DExtensions.) |
Fields
Name | Description | |
---|---|---|
components | (Inherited from Entity.) | |
lastTickLerpComponents |
Each element can either be a Lerp, a Lerp List or an array of Lerp objects.
View code on GitHub (Inherited from DrawableEntity.) |
Properties
Name | Description | |
---|---|---|
Alpha | (Inherited from Entity2D.) | |
Center | (Inherited from Entity2D.) | |
Color | (Inherited from Entity2D.) | |
DidFootprintChange | (Inherited from Entity2D.) | |
DrawArea | (Inherited from Polygon2D.) | |
IsActive | (Inherited from DrawableEntity.) | |
IsPauseable | (Inherited from Entity.) | |
IsVisible | (Inherited from DrawableEntity.) | |
LastColor | (Inherited from Entity2D.) | |
LastDrawArea | (Inherited from Entity2D.) | |
NumberOfComponents | (Inherited from Entity.) | |
Points | (Inherited from Polygon2D.) | |
RenderLayer | (Inherited from DrawableEntity.) | |
Rotation | (Inherited from Entity2D.) | |
RotationCenter | (Inherited from Entity2D.) | |
Size | (Inherited from Entity2D.) | |
TopLeft | (Inherited from Entity2D.) | |
UpdatePriority | (Inherited from Entity.) |
Remarks
Examples
[Test, ApproveFirstFrameScreenshot] public void RenderRect() { new FilledRect(new Rectangle(0.3f, 0.3f, 0.4f, 0.4f), Color.Blue); }
[Test] public void RenderManyRects() { var random = Core.Randomizer.Current; for (int num = 0; num < 20; num++) new FilledRect(new Rectangle(random.Get(0.0f, 0.8f), random.Get(0.2f, 0.8f), 0.2f, 0.2f), Color.GetRandomColor()); }
[Test, ApproveFirstFrameScreenshot] public void CheckCollisionOnAllSidesWithRotatedRectangles() { var rect = new FilledRect(new Rectangle(0.4f, 0.4f, 0.2f, 0.2f), Color.White); var top = new FilledRect(new Rectangle(0.4f, 0.2f, 0.2f, 0.2f), Color.Yellow) { Rotation = 45 }; var left = new FilledRect(new Rectangle(0.2f, 0.4f, 0.2f, 0.2f), Color.Blue) { Rotation = 135 }; var bottom = new FilledRect(new Rectangle(0.4f, 0.6f, 0.2f, 0.2f), Color.Green) { Rotation = 225 }; var right = new FilledRect(new Rectangle(0.6f, 0.4f, 0.2f, 0.2f), Color.Red) { Rotation = 315 }; Assert.IsTrue(rect.DrawArea.IsColliding(0, top.DrawArea, top.Rotation)); Assert.IsTrue(rect.DrawArea.IsColliding(0, left.DrawArea, left.Rotation)); Assert.IsTrue(rect.DrawArea.IsColliding(0, bottom.DrawArea, bottom.Rotation)); Assert.IsTrue(rect.DrawArea.IsColliding(0, right.DrawArea, right.Rotation)); }
See Also