Class PointExtensions
Extensions for the Point type.
Inherited Members
Namespace: SadConsole
Assembly: SadConsole.dll
Syntax
public static class PointExtensions
Methods
GetDirectionIndexes(Point, Rectangle, int)
Gets an array of indexes of a surface based on a position and then a relative SadRogue.Primitives.Direction.Type direction enumeration..
Declaration
public static int[] GetDirectionIndexes(this Point position, Rectangle area, int width)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The position center. |
Rectangle | area | The area containing the position. |
int | width | The width to use in converting each index to a point. |
Returns
Type | Description |
---|---|
int[] | Returns the an array of values indidcating the index in the area surface of each direction where -1 represents a position outside the bounds of the area. Indexed by a SadRogue.Primitives.Direction.Types enumeration. |
GetDirectionPoints(Point)
Gets an indexed array of direction positions based on the position
.
Declaration
public static Point[] GetDirectionPoints(this Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The source position. |
Returns
Type | Description |
---|---|
Point[] | An array of positions indexed by a SadRogue.Primitives.Direction.Types enumeration. Index 0 in the array represents the |
GetValidDirections(Point, Rectangle)
Gets a list of indexed boolean values to indicate if the direction from the position
falls in the area
.
Declaration
public static bool[] GetValidDirections(this Point position, Rectangle area)
Parameters
Returns
Type | Description |
---|---|
bool[] | An array of bool values indicating if the direction is valid or not; indexed by a SadRogue.Primitives.Direction.Types enumeration. Index 0 in the array represents the |
PixelLocationToSurface(Point, Point)
Translates a pixel to where it appears on a surface cell.
Declaration
public static Point PixelLocationToSurface(this Point point, Point fontSize)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The current world position. |
Point | fontSize | The font to use in calculating the position. |
Returns
Type | Description |
---|---|
Point | The cell position on the screen. |
PixelLocationToSurface(Point, int, int)
Translates a pixel to where it appears on a surface cell.
Declaration
public static Point PixelLocationToSurface(this Point point, int cellWidth, int cellHeight)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The current world position. |
int | cellWidth | The width of a cell in pixels. |
int | cellHeight | The height of a cell in pixels. |
Returns
Type | Description |
---|---|
Point | The cell position on the screen. |
SurfaceLocationToPixel(Point, Point)
Translates a surface cell position to where it appears on the screen in pixels.
Declaration
public static Point SurfaceLocationToPixel(this Point point, Point fontSize)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The current cell position. |
Point | fontSize | The font to use in calculating the position. |
Returns
Type | Description |
---|---|
Point | The pixel position of the top-left of the cell. |
SurfaceLocationToPixel(Point, int, int)
Translates a surface cell position to where it appears on the screen in pixels.
Declaration
public static Point SurfaceLocationToPixel(this Point point, int cellWidth, int cellHeight)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The current cell position. |
int | cellWidth | The width of a cell in pixels. |
int | cellHeight | The height of a cell in pixels. |
Returns
Type | Description |
---|---|
Point | The pixel position of the top-left of the cell. |
TranslateFont(Point, Point, Point)
Translates the coordinates of a cell from the source font size to a target font size.
Declaration
public static Point TranslateFont(this Point point, Point sourceFontSize, Point targetFontSize)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The position of the cell in the |
Point | sourceFontSize | The source font translating from. |
Point | targetFontSize | The target font translating to. |
Returns
Type | Description |
---|---|
Point | The position of the cell in the |