-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v.1.0.1 added primitives, Circle, Line, FilledRectangle
fixed som bugs
- Loading branch information
Showing
15 changed files
with
445 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using Microsoft.Xna.Framework; | ||
|
||
namespace MonoGame.UI.Forms | ||
{ | ||
public class Circle : Control | ||
{ | ||
public float Radius { get; set; } | ||
|
||
public Vector2 Center | ||
{ | ||
get => new Vector2(Location.X + Radius, Location.Y + Radius); | ||
set => Location = new Vector2(value.X - Radius, value.Y - Radius); | ||
} | ||
|
||
public Circle(Vector2 center, float radius) | ||
{ | ||
Radius = radius; | ||
Center = center; | ||
BackgroundColor = Color.White; | ||
Size = new Vector2(radius * 2, radius * 2); | ||
} | ||
|
||
internal override void Draw(DrawHelper helper, Vector2 offset) | ||
{ | ||
helper.DrawCircle(Center + offset, Radius, BackgroundColor); | ||
} | ||
|
||
public override bool Contains(Point point) | ||
{ | ||
var delta = point.ToVector2() - Center; | ||
return (delta.LengthSquared() < (float)(Radius * Radius)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.