C# 클래스 Nez.RectangleExt

파일 보기 프로젝트 열기: prime31/Nez 1 사용 예제들

공개 메소드들

메소드 설명
boundsFromPolygonPoints ( Vector2 points ) : Rectangle

given the points of a polygon calculates the bounds

calculateBounds ( Rectangle &rect, Vector2 parentPosition, Vector2 position, Vector2 origin, Vector2 scale, float rotation, float width, float height ) : void
clone ( this rect ) : Rectangle

clones and returns a new Rectangle with the same data as the current rectangle

collisionCheck ( Rectangle &rect, Rectangle &other, float &moveX, float &moveY ) : bool

returns true if the boxes are colliding moveX and moveY will return the movement that b1 must move to avoid the collision

contract ( Rectangle &rect, int horizontalAmount, int verticalAmount ) : void
expandSide ( Rectangle &rect, System.Edge edge, int amount ) : void
fromFloats ( float x, float y, float width, float height ) : Rectangle

returns a rectangle from the passed in floats

fromMinMaxPoints ( Point min, Point max ) : Rectangle

creates a Rectangle given min/max points (top-left, bottom-right points)

getCenter ( Rectangle &rect ) : Vector2

gets the center point of the rectangle as a Vector2

getCenter ( this rect ) : Vector2

gets the center point of the rectangle as a Vector2

getClosestPointOnBoundsToOrigin ( Rectangle &rect ) : Vector2
getClosestPointOnRectangleBorderToPoint ( Rectangle &rect, Vector2 point ) : Point

gets the closest point that is on the rectangle border to the given point

getClosestPointOnRectangleToPoint ( Rectangle &rect, Vector2 point ) : Vector2

returns the closest point that is in or on the Rectangle to the given point

getHalfRect ( this rect, System.Edge edge ) : Rectangle
getHalfSize ( this rect ) : Vector2

gets the half size of the rect

getIntersectionDepth ( Rectangle &rectA, Rectangle &rectB ) : Vector2

Calculates the signed depth of intersection between two rectangles.

getMax ( Rectangle &rect ) : Point

gets the max point of the rectangle, the bottom-right corner

getPosition ( Rectangle &rect ) : Vector2

gets the position of the rectangle as a Vector2

getRectEdgePortion ( this rect, System.Edge edge, int size = 1 ) : Rectangle

gets a portion of the Rectangle with a width/height of size that is on the Edge of the Rectangle but still contained within it.

getSide ( this rect, System.Edge edge ) : int

gets the position of the specified side

getSweptBroadphaseBounds ( Rectangle &rect, float deltaX, float deltaY ) : Rectangle

returns a Bounds the spans the current bounds and the provided delta positions

getSweptBroadphaseBounds ( Rectangle &rect, int deltaX, int deltaY ) : Rectangle

returns a Bounds the spans the current bounds and the provided delta positions

intersect ( Rectangle &rect1, Rectangle &rect2 ) : bool

returns true if rect1 intersects rect2

rayIntersects ( Rectangle &rect, Ray2D &ray, float &distance ) : bool
rayIntersects ( this rectangle, Microsoft.Xna.Framework.Ray ray ) : float?
scale ( Rectangle &rect, Vector2 scale ) : void

scales the rect

translate ( Rectangle &rect, Vector2 vec ) : void
union ( Rectangle &first, Point &point, Rectangle &result ) : void

Update first to be the union of first and point

union ( Rectangle &value1, Rectangle &value2, Rectangle &result ) : void

calculates the union of the two Rectangles. The result will be a rectangle that encompasses the other two.

메소드 상세

boundsFromPolygonPoints() 공개 정적인 메소드

given the points of a polygon calculates the bounds
public static boundsFromPolygonPoints ( Vector2 points ) : Rectangle
points Vector2 Points.
리턴 Microsoft.Xna.Framework.Rectangle

calculateBounds() 공개 정적인 메소드

public static calculateBounds ( Rectangle &rect, Vector2 parentPosition, Vector2 position, Vector2 origin, Vector2 scale, float rotation, float width, float height ) : void
rect Microsoft.Xna.Framework.Rectangle
parentPosition Vector2
position Vector2
origin Vector2
scale Vector2
rotation float
width float
height float
리턴 void

clone() 공개 정적인 메소드

clones and returns a new Rectangle with the same data as the current rectangle
public static clone ( this rect ) : Rectangle
rect this Rect.
리턴 Microsoft.Xna.Framework.Rectangle

collisionCheck() 공개 정적인 메소드

returns true if the boxes are colliding moveX and moveY will return the movement that b1 must move to avoid the collision
public static collisionCheck ( Rectangle &rect, Rectangle &other, float &moveX, float &moveY ) : bool
rect Microsoft.Xna.Framework.Rectangle
other Microsoft.Xna.Framework.Rectangle Other.
moveX float Move x.
moveY float Move y.
리턴 bool

contract() 공개 정적인 메소드

public static contract ( Rectangle &rect, int horizontalAmount, int verticalAmount ) : void
rect Microsoft.Xna.Framework.Rectangle
horizontalAmount int
verticalAmount int
리턴 void

expandSide() 공개 정적인 메소드

public static expandSide ( Rectangle &rect, System.Edge edge, int amount ) : void
rect Microsoft.Xna.Framework.Rectangle
edge System.Edge
amount int
리턴 void

fromFloats() 공개 정적인 메소드

returns a rectangle from the passed in floats
public static fromFloats ( float x, float y, float width, float height ) : Rectangle
x float The x coordinate.
y float The y coordinate.
width float Width.
height float Height.
리턴 Microsoft.Xna.Framework.Rectangle

fromMinMaxPoints() 공개 정적인 메소드

creates a Rectangle given min/max points (top-left, bottom-right points)
public static fromMinMaxPoints ( Point min, Point max ) : Rectangle
min Point Minimum.
max Point Max.
리턴 Microsoft.Xna.Framework.Rectangle

getCenter() 공개 정적인 메소드

gets the center point of the rectangle as a Vector2
public static getCenter ( Rectangle &rect ) : Vector2
rect Microsoft.Xna.Framework.Rectangle Rect.
리턴 Vector2

getCenter() 공개 정적인 메소드

gets the center point of the rectangle as a Vector2
public static getCenter ( this rect ) : Vector2
rect this Rect.
리턴 Vector2

getClosestPointOnBoundsToOrigin() 공개 정적인 메소드

public static getClosestPointOnBoundsToOrigin ( Rectangle &rect ) : Vector2
rect Microsoft.Xna.Framework.Rectangle
리턴 Vector2

getClosestPointOnRectangleBorderToPoint() 공개 정적인 메소드

gets the closest point that is on the rectangle border to the given point
public static getClosestPointOnRectangleBorderToPoint ( Rectangle &rect, Vector2 point ) : Point
rect Microsoft.Xna.Framework.Rectangle Rect.
point Vector2 Point.
리턴 Point

getClosestPointOnRectangleToPoint() 공개 정적인 메소드

returns the closest point that is in or on the Rectangle to the given point
public static getClosestPointOnRectangleToPoint ( Rectangle &rect, Vector2 point ) : Vector2
rect Microsoft.Xna.Framework.Rectangle Rect.
point Vector2 Point.
리턴 Vector2

getHalfRect() 공개 정적인 메소드

public static getHalfRect ( this rect, System.Edge edge ) : Rectangle
rect this
edge System.Edge
리턴 Microsoft.Xna.Framework.Rectangle

getHalfSize() 공개 정적인 메소드

gets the half size of the rect
public static getHalfSize ( this rect ) : Vector2
rect this Rect.
리턴 Vector2

getIntersectionDepth() 공개 정적인 메소드

Calculates the signed depth of intersection between two rectangles.
public static getIntersectionDepth ( Rectangle &rectA, Rectangle &rectB ) : Vector2
rectA Microsoft.Xna.Framework.Rectangle
rectB Microsoft.Xna.Framework.Rectangle
리턴 Vector2

getMax() 공개 정적인 메소드

gets the max point of the rectangle, the bottom-right corner
public static getMax ( Rectangle &rect ) : Point
rect Microsoft.Xna.Framework.Rectangle Rect.
리턴 Point

getPosition() 공개 정적인 메소드

gets the position of the rectangle as a Vector2
public static getPosition ( Rectangle &rect ) : Vector2
rect Microsoft.Xna.Framework.Rectangle Rect.
리턴 Vector2

getRectEdgePortion() 공개 정적인 메소드

gets a portion of the Rectangle with a width/height of size that is on the Edge of the Rectangle but still contained within it.
public static getRectEdgePortion ( this rect, System.Edge edge, int size = 1 ) : Rectangle
rect this Rect.
edge System.Edge Edge.
size int Size.
리턴 Microsoft.Xna.Framework.Rectangle

getSide() 공개 정적인 메소드

gets the position of the specified side
public static getSide ( this rect, System.Edge edge ) : int
rect this
edge System.Edge Side.
리턴 int

getSweptBroadphaseBounds() 공개 정적인 메소드

returns a Bounds the spans the current bounds and the provided delta positions
public static getSweptBroadphaseBounds ( Rectangle &rect, float deltaX, float deltaY ) : Rectangle
rect Microsoft.Xna.Framework.Rectangle
deltaX float
deltaY float
리턴 Microsoft.Xna.Framework.Rectangle

getSweptBroadphaseBounds() 공개 정적인 메소드

returns a Bounds the spans the current bounds and the provided delta positions
public static getSweptBroadphaseBounds ( Rectangle &rect, int deltaX, int deltaY ) : Rectangle
rect Microsoft.Xna.Framework.Rectangle
deltaX int
deltaY int
리턴 Microsoft.Xna.Framework.Rectangle

intersect() 공개 정적인 메소드

returns true if rect1 intersects rect2
public static intersect ( Rectangle &rect1, Rectangle &rect2 ) : bool
rect1 Microsoft.Xna.Framework.Rectangle
rect2 Microsoft.Xna.Framework.Rectangle
리턴 bool

rayIntersects() 공개 정적인 메소드

public static rayIntersects ( Rectangle &rect, Ray2D &ray, float &distance ) : bool
rect Microsoft.Xna.Framework.Rectangle
ray Ray2D
distance float
리턴 bool

rayIntersects() 공개 정적인 메소드

public static rayIntersects ( this rectangle, Microsoft.Xna.Framework.Ray ray ) : float?
rectangle this
ray Microsoft.Xna.Framework.Ray
리턴 float?

scale() 공개 정적인 메소드

scales the rect
public static scale ( Rectangle &rect, Vector2 scale ) : void
rect Microsoft.Xna.Framework.Rectangle Rect.
scale Vector2 Scale.
리턴 void

translate() 공개 정적인 메소드

public static translate ( Rectangle &rect, Vector2 vec ) : void
rect Microsoft.Xna.Framework.Rectangle
vec Vector2
리턴 void

union() 공개 정적인 메소드

Update first to be the union of first and point
public static union ( Rectangle &first, Point &point, Rectangle &result ) : void
first Microsoft.Xna.Framework.Rectangle First.
point Point Point.
result Microsoft.Xna.Framework.Rectangle Result.
리턴 void

union() 공개 정적인 메소드

calculates the union of the two Rectangles. The result will be a rectangle that encompasses the other two.
public static union ( Rectangle &value1, Rectangle &value2, Rectangle &result ) : void
value1 Microsoft.Xna.Framework.Rectangle
value2 Microsoft.Xna.Framework.Rectangle
result Microsoft.Xna.Framework.Rectangle Result.
리턴 void