PointExtensions Class
Definition
Section titled “Definition”Extensions for the SadRogue.Primitives.Point type.
public static class PointExtensionsInheritance object
Methods
Section titled “Methods”SurfaceLocationToPixel(Point, int, int)
Section titled “SurfaceLocationToPixel(Point, int, int)”Translates a surface cell position to where it appears on the screen in pixels.
public static Point SurfaceLocationToPixel(this Point point, int cellWidth, int cellHeight)Parameters
Section titled “Parameters”point SadRogue.Primitives.Point
The current cell position.
cellWidth int
The width of a cell in pixels.
cellHeight int
The height of a cell in pixels.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The pixel position of the top-left of the cell.
SurfaceLocationToPixel(Point, Point)
Section titled “SurfaceLocationToPixel(Point, Point)”Translates a surface cell position to where it appears on the screen in pixels.
public static Point SurfaceLocationToPixel(this Point point, Point fontSize)Parameters
Section titled “Parameters”point SadRogue.Primitives.Point
The current cell position.
fontSize SadRogue.Primitives.Point
The font to use in calculating the position.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The pixel position of the top-left of the cell.
PixelLocationToSurface(Point, int, int)
Section titled “PixelLocationToSurface(Point, int, int)”Translates a pixel to where it appears on a surface cell.
public static Point PixelLocationToSurface(this Point point, int cellWidth, int cellHeight)Parameters
Section titled “Parameters”point SadRogue.Primitives.Point
The current world position.
cellWidth int
The width of a cell in pixels.
cellHeight int
The height of a cell in pixels.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The cell position on the screen.
PixelLocationToSurface(Point, Point)
Section titled “PixelLocationToSurface(Point, Point)”Translates a pixel to where it appears on a surface cell.
public static Point PixelLocationToSurface(this Point point, Point fontSize)Parameters
Section titled “Parameters”point SadRogue.Primitives.Point
The current world position.
fontSize SadRogue.Primitives.Point
The font to use in calculating the position.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The cell position on the screen.
TranslateFont(Point, Point, Point)
Section titled “TranslateFont(Point, Point, Point)”Translates the coordinates of a cell from the source font size to a target font size.
public static Point TranslateFont(this Point point, Point sourceFontSize, Point targetFontSize)Parameters
Section titled “Parameters”point SadRogue.Primitives.Point
The position of the cell in the sourceFontSize.
sourceFontSize SadRogue.Primitives.Point
The source font translating from.
targetFontSize SadRogue.Primitives.Point
The target font translating to.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The position of the cell in the targetFontSize.
GetValidDirections(Point, Rectangle)
Section titled “GetValidDirections(Point, Rectangle)”Gets a list of indexed boolean values to indicate if the direction from the position falls in the area.
public static bool[] GetValidDirections(this Point position, Rectangle area)Parameters
Section titled “Parameters”position SadRogue.Primitives.Point
The position to test from.
area SadRogue.Primitives.Rectangle
The area to test.
Returns
Section titled “Returns”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 position.
GetDirectionPoints(Point)
Section titled “GetDirectionPoints(Point)”Gets an indexed array of direction positions based on the position.
public static Point[] GetDirectionPoints(this Point position)Parameters
Section titled “Parameters”position SadRogue.Primitives.Point
The source position.
Returns
Section titled “Returns”SadRogue.Primitives.Point[]
An array of positions indexed by a SadRogue.Primitives.Direction.Types enumeration. Index 0 in the array represents the position.
GetDirectionIndexes(Point, Rectangle, int)
Section titled “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..
public static int[] GetDirectionIndexes(this Point position, Rectangle area, int width)Parameters
Section titled “Parameters”position SadRogue.Primitives.Point
The position center.
area SadRogue.Primitives.Rectangle
The area containing the position.
width int
The width to use in converting each index to a point.
Returns
Section titled “Returns”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.