C# Class SFML.Graphics.Shape

Base class for textured shapes with outline
Inheritance: Transformable, Drawable
Show file Open project: SFML/SFML.Net Class Usage Examples

Public Methods

Method Description
Draw ( RenderTarget target, RenderStates states ) : void

Draw the shape to a render target

GetGlobalBounds ( ) : FloatRect

Get the global bounding rectangle of the entity. The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

GetLocalBounds ( ) : FloatRect

Get the local bounding rectangle of the entity. The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

GetPoint ( uint index ) : Vector2f

Get the position of a point The returned point is in local coordinates, that is, the shape's transforms (position, rotation, scale) are not taken into account. The result is undefined if index is out of the valid range.

GetPointCount ( ) : uint

Get the total number of points of the shape

Shape ( Shape copy ) : System

Construct the shape from another shape

Protected Methods

Method Description
Destroy ( bool disposing ) : void

Handle the destruction of the object

Shape ( ) : System

Default constructor

Update ( ) : void

Recompute the internal geometry of the shape. This function must be called by the derived class everytime the shape's points change (ie. the result of either PointCount or GetPoint is different).

Private Methods

Method Description
InternalGetPoint ( uint index, IntPtr userData ) : Vector2f

Callback passed to the C API

InternalGetPointCount ( IntPtr userData ) : uint

Callback passed to the C API

sfRenderTexture_drawShape ( IntPtr CPointer, IntPtr Shape, RenderStates &states ) : void
sfRenderWindow_drawShape ( IntPtr CPointer, IntPtr Shape, RenderStates &states ) : void
sfShape_copy ( IntPtr Shape ) : IntPtr
sfShape_create ( GetPointCountCallbackType getPointCount, GetPointCallbackType getPoint, IntPtr userData ) : IntPtr
sfShape_destroy ( IntPtr CPointer ) : void
sfShape_getFillColor ( IntPtr CPointer ) : System.Color
sfShape_getLocalBounds ( IntPtr CPointer ) : FloatRect
sfShape_getOutlineColor ( IntPtr CPointer ) : System.Color
sfShape_getOutlineThickness ( IntPtr CPointer ) : float
sfShape_getTextureRect ( IntPtr CPointer ) : IntRect
sfShape_setFillColor ( IntPtr CPointer, System.Color Color ) : void
sfShape_setOutlineColor ( IntPtr CPointer, System.Color Color ) : void
sfShape_setOutlineThickness ( IntPtr CPointer, float Thickness ) : void
sfShape_setTexture ( IntPtr CPointer, IntPtr Texture, bool AdjustToNewSize ) : void
sfShape_setTextureRect ( IntPtr CPointer, IntRect Rect ) : void
sfShape_update ( IntPtr CPointer ) : void

Method Details

Destroy() protected method

Handle the destruction of the object
protected Destroy ( bool disposing ) : void
disposing bool Is the GC disposing the object, or is it an explicit call ?
return void

Draw() public method

Draw the shape to a render target
public Draw ( RenderTarget target, RenderStates states ) : void
target RenderTarget Render target to draw to
states RenderStates Current render states
return void

GetGlobalBounds() public method

Get the global bounding rectangle of the entity. The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.
public GetGlobalBounds ( ) : FloatRect
return FloatRect

GetLocalBounds() public method

Get the local bounding rectangle of the entity. The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
public GetLocalBounds ( ) : FloatRect
return FloatRect

GetPoint() public abstract method

Get the position of a point The returned point is in local coordinates, that is, the shape's transforms (position, rotation, scale) are not taken into account. The result is undefined if index is out of the valid range.
public abstract GetPoint ( uint index ) : Vector2f
index uint Index of the point to get, in range [0 .. PointCount - 1]
return Vector2f

GetPointCount() public abstract method

Get the total number of points of the shape
public abstract GetPointCount ( ) : uint
return uint

Shape() protected method

Default constructor
protected Shape ( ) : System
return System

Shape() public method

Construct the shape from another shape
public Shape ( Shape copy ) : System
copy Shape Shape to copy
return System

Update() protected method

Recompute the internal geometry of the shape. This function must be called by the derived class everytime the shape's points change (ie. the result of either PointCount or GetPoint is different).
protected Update ( ) : void
return void