Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Circle #3419

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Build/Projects/MonoGame.Framework.definition
Expand Up @@ -183,6 +183,7 @@
<Compile Include="BoundingBox.cs" />
<Compile Include="BoundingFrustum.cs" />
<Compile Include="BoundingSphere.cs" />
<Compile Include="Circle.cs" />
<Compile Include="Color.cs" />
<Compile Include="ContainmentType.cs" />
<Compile Include="CurveContinuity.cs" />
Expand Down Expand Up @@ -332,6 +333,7 @@
<Compile Include="Content\ContentReaders\BoundingSphereReader.cs" />
<Compile Include="Content\ContentReaders\ByteReader.cs" />
<Compile Include="Content\ContentReaders\CharReader.cs" />
<Compile Include="Content\ContentReaders\CircleReader.cs" />
<Compile Include="Content\ContentReaders\ColorReader.cs" />
<Compile Include="Content\ContentReaders\CurveReader.cs" />
<Compile Include="Content\ContentReaders\DateTimeReader.cs" />
Expand Down
1 change: 1 addition & 0 deletions Build/Projects/MonoGame.Tests.definition
Expand Up @@ -85,6 +85,7 @@
</Compile>

<Compile Include="Framework\Bounding.cs" />
<Compile Include="Framework\CircleTest.cs" />
<Compile Include="Framework\ColorTest.cs" />
<Compile Include="Framework\CurveKeyCollectionTest.cs" />
<Compile Include="Framework\CurveKeyTest.cs" />
Expand Down
20 changes: 19 additions & 1 deletion Documentation/improvements.md
@@ -1,12 +1,13 @@
The new API features which are available in the current development release and does not exist in XNA.


##Graphics and window routines

[GameWindow.AllowAltF4](http://www.monogame.net/documentation/?page=P_Microsoft_Xna_Framework_GameWindow_AllowAltF4) - boolean that allows or disallow using Alt+F4 combo for game window closing. You can change it anytime in your code. Note : this isnt working on WinRT projects because Alt+F4 is intended to work always on this platform.

[GameWindow.IsBorderless](http://www.monogame.net/documentation/?page=P_Microsoft_Xna_Framework_GameWindow_IsBorderless) - boolean that makes border of your window invisible. You cannot move or resize your game window after this boolean setted to true. Works only on desktop platforms.

##Math
##Math and geometry routines

[MathHelper.Clamp(int,int,int)](http://www.monogame.net/documentation/?page=M_Microsoft_Xna_Framework_MathHelper_Clamp_1) - this overload clamps integers instead floats which could be useful in some cases. You dont need to convert like this MathHelper.Clamp((float)integer,(float)min,(float)max) anymore.

Expand Down Expand Up @@ -34,6 +35,23 @@ Vector2 vector2 = new Vector2(10.01f,10.99f);
var point = vector2.ToPoint(); // point will be 10,10.
```

[Circle](http://www.monogame.net/documentation/?page=T_Microsoft_Xna_Framework_Circle) - A Circle which can be used for circle-based bounds and collisions. Circle contains methods of getting points on the circles edge with a specified radii in addition to ones for checking intersection with other Circles and [Rectangles](http://www.monogame.net/documentation/?page=T_Microsoft_Xna_Framework_Rectangle)

```

Circle circle = new Circle(new Vector2(200.0f, 300.0f), 100.0f);
Rectangle rectangleAroundCircle = circle.ToRectangle();

bool containsFloat = circle.Contains(200.0f, 300.0f);
bool containsPoint = circle.Contains(new Point(200, 300));
bool containsVector2 = circle.Contains(new Vector2(200.0f, 300.0f));
bool containsCircle = circle.Contains(new Circle(new Vector2(200.0f, 300.0f), 25.0f));

bool intersectsCircle = circle.Intersects(new Circle(new Vector2(350.0f, 300.0f), 100.0f));
bool intersectsRectangle = circle.Intersects(new Rectangle(250, 350, 150, 100));

```

##Input

[MouseState.Position](http://www.monogame.net/documentation/?page=P_Microsoft_Xna_Framework_Input_MouseState_Position) - property which returns a [Point](http://www.monogame.net/documentation/?page=T_Microsoft_Xna_Framework_Point) which contains X and Y parameters of MouseState. Before this change it is harder to obtain mouse position in a good way. You can now write something like this
Expand Down