Shape.h File Reference

#include <SFML/Config.h>
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Types.h>

Go to the source code of this file.


Functions

CSFML_API sfShapesfShape_Create ()
 Create a new shape.
CSFML_API sfShapesfShape_CreateLine (float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol)
 Create a new shape made of a single line.
CSFML_API sfShapesfShape_CreateRectangle (float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol)
 Create a new shape made of a single rectangle.
CSFML_API sfShapesfShape_CreateCircle (float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol)
 Create a new shape made of a single circle.
CSFML_API void sfShape_Destroy (sfShape *Shape)
 Destroy an existing Shape.
CSFML_API void sfShape_SetX (sfShape *Shape, float X)
 Set the X position of a shape.
CSFML_API void sfShape_SetY (sfShape *Shape, float Y)
 Set the Y position of a shape.
CSFML_API void sfShape_SetPosition (sfShape *Shape, float X, float Y)
 Set the position of a shape.
CSFML_API void sfShape_SetScaleX (sfShape *Shape, float Scale)
 Set the horizontal scale of a shape.
CSFML_API void sfShape_SetScaleY (sfShape *Shape, float Scale)
 Set the vertical scale of a shape.
CSFML_API void sfShape_SetScale (sfShape *Shape, float ScaleX, float ScaleY)
 Set the scale of a shape.
CSFML_API void sfShape_SetRotation (sfShape *Shape, float Rotation)
 Set the orientation of a shape.
CSFML_API void sfShape_SetCenter (sfShape *Shape, float X, float Y)
 Set the center of a shape, in coordinates relative to its left-top corner.
CSFML_API void sfShape_SetColor (sfShape *Shape, sfColor Color)
 Set the color of a shape.
CSFML_API void sfShape_SetBlendMode (sfShape *Shape, sfBlendMode Mode)
 Set the blending mode for a shape.
CSFML_API float sfShape_GetX (sfShape *Shape)
 Get the X position of a shape.
CSFML_API float sfShape_GetY (sfShape *Shape)
 Get the Y position of a shape.
CSFML_API float sfShape_GetScaleX (sfShape *Shape)
 Get the horizontal scale of a shape.
CSFML_API float sfShape_GetScaleY (sfShape *Shape)
 Get the vertical scale of a shape.
CSFML_API float sfShape_GetRotation (sfShape *Shape)
 Get the orientation of a shape.
CSFML_API float sfShape_GetCenterX (sfShape *Shape)
 Get the X position of the center a shape.
CSFML_API float sfShape_GetCenterY (sfShape *Shape)
 Get the Y position of the center a shape.
CSFML_API sfColor sfShape_GetColor (sfShape *Shape)
 Get the color of a shape.
CSFML_API sfBlendMode sfShape_GetBlendMode (sfShape *Shape)
 Get the current blending mode of a shape.
CSFML_API void sfShape_Move (sfShape *Shape, float OffsetX, float OffsetY)
 Move a shape.
CSFML_API void sfShape_Scale (sfShape *Shape, float FactorX, float FactorY)
 Scale a shape.
CSFML_API void sfShape_Rotate (sfShape *Shape, float Angle)
 Rotate a shape.
CSFML_API void sfShape_TransformToLocal (sfShape *Shape, float PointX, float PointY, float *X, float *Y)
 Transform a point from global coordinates into the shape's local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point).
CSFML_API void sfShape_TransformToGlobal (sfShape *Shape, float PointX, float PointY, float *X, float *Y)
 Transform a point from the shape's local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point).
CSFML_API void sfShape_AddPoint (sfShape *Shape, float X, float Y, sfColor Col, sfColor OutlineCol)
 Add a point to a shape.
CSFML_API void sfShape_EnableFill (sfShape *Shape, sfBool Enable)
 Enable or disable filling a shape.
CSFML_API void sfShape_EnableOutline (sfShape *Shape, sfBool Enable)
 Enable or disable drawing a shape outline.
CSFML_API void sfShape_SetOutlineWidth (sfShape *Shape, float Width)
 Change the width of a shape outline.
CSFML_API float sfShape_GetOutlineWidth (sfShape *Shape)
 Get the width of a shape outline.
CSFML_API unsigned int sfShape_GetNbPoints (sfShape *Shape)
 Get the number of points composing a shape.
CSFML_API void sfShape_GetPointPosition (sfShape *Shape, unsigned int Index, float *X, float *Y)
 Get a the position of a shape's point.
CSFML_API sfColor sfShape_GetPointColor (sfShape *Shape, unsigned int Index)
 Get a the color of a shape's point.
CSFML_API sfColor sfShape_GetPointOutlineColor (sfShape *Shape, unsigned int Index)
 Get a the outline color of a shape's point.
CSFML_API void sfShape_SetPointPosition (sfShape *Shape, unsigned int Index, float X, float Y)
 Set a the position of a shape's point.
CSFML_API void sfShape_SetPointColor (sfShape *Shape, unsigned int Index, sfColor Color)
 Set a the color of a shape's point.
CSFML_API void sfShape_SetPointOutlineColor (sfShape *Shape, unsigned int Index, sfColor Color)
 Set a the outline color of a shape's point.

Function Documentation

CSFML_API void sfShape_AddPoint ( sfShape Shape,
float  X,
float  Y,
sfColor  Col,
sfColor  OutlineCol 
)

Add a point to a shape.

Parameters:
Shape : Shape to modify
X,Y : Position of the point
Col : Color of the point
OutlineCol : Outline color of the point

CSFML_API sfShape* sfShape_Create (  ) 

Create a new shape.

Returns:
A new sfShape object, or NULL if it failed

CSFML_API sfShape* sfShape_CreateCircle ( float  X,
float  Y,
float  Radius,
sfColor  Col,
float  Outline,
sfColor  OutlineCol 
)

Create a new shape made of a single circle.

Parameters:
X,Y : Position of the center
Radius : Radius
Col : Color used to fill the circle
Outline : Outline width
OutlineCol : Color used to draw the outline

CSFML_API sfShape* sfShape_CreateLine ( float  P1X,
float  P1Y,
float  P2X,
float  P2Y,
float  Thickness,
sfColor  Col,
float  Outline,
sfColor  OutlineCol 
)

Create a new shape made of a single line.

Parameters:
P1X,P1Y : Position of the first point
P2X,P2Y : Position second point
Thickness : Line thickness
Col : Color used to draw the line
Outline : Outline width
OutlineCol : Color used to draw the outline

CSFML_API sfShape* sfShape_CreateRectangle ( float  P1X,
float  P1Y,
float  P2X,
float  P2Y,
sfColor  Col,
float  Outline,
sfColor  OutlineCol 
)

Create a new shape made of a single rectangle.

Parameters:
P1X,P1Y : Position of the first point
P2X,P2Y : Position second point
Col : Color used to fill the rectangle
Outline : Outline width
OutlineCol : Color used to draw the outline

CSFML_API void sfShape_Destroy ( sfShape Shape  ) 

Destroy an existing Shape.

Parameters:
Shape : Shape to delete

CSFML_API void sfShape_EnableFill ( sfShape Shape,
sfBool  Enable 
)

Enable or disable filling a shape.

Fill is enabled by default

Parameters:
Enable : True to enable, false to disable

CSFML_API void sfShape_EnableOutline ( sfShape Shape,
sfBool  Enable 
)

Enable or disable drawing a shape outline.

Outline is enabled by default

Parameters:
Shape : Shape to modify
Enable : True to enable, false to disable

CSFML_API sfBlendMode sfShape_GetBlendMode ( sfShape Shape  ) 

Get the current blending mode of a shape.

Parameters:
Shape : Shape to read
Returns:
Current blending mode

CSFML_API float sfShape_GetCenterX ( sfShape Shape  ) 

Get the X position of the center a shape.

Parameters:
Shape : Shape to read
Returns:
Current X center

CSFML_API float sfShape_GetCenterY ( sfShape Shape  ) 

Get the Y position of the center a shape.

Parameters:
Shape : Shape to read
Returns:
Current Y center

CSFML_API sfColor sfShape_GetColor ( sfShape Shape  ) 

Get the color of a shape.

Parameters:
Shape : Shape to read
Returns:
Current color

CSFML_API unsigned int sfShape_GetNbPoints ( sfShape Shape  ) 

Get the number of points composing a shape.

Parameters:
Shape : Shape to read
Returns:
Total number of points

CSFML_API float sfShape_GetOutlineWidth ( sfShape Shape  ) 

Get the width of a shape outline.

Parameters:
Shape : Shape to read
return Current outline width

CSFML_API sfColor sfShape_GetPointColor ( sfShape Shape,
unsigned int  Index 
)

Get a the color of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
Returns:
Color of the point

CSFML_API sfColor sfShape_GetPointOutlineColor ( sfShape Shape,
unsigned int  Index 
)

Get a the outline color of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
Returns:
Outline color of the point

CSFML_API void sfShape_GetPointPosition ( sfShape Shape,
unsigned int  Index,
float *  X,
float *  Y 
)

Get a the position of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
X : Variable to fill with the X coordinate of the point
Y : Variable to fill with the Y coordinate of the point

CSFML_API float sfShape_GetRotation ( sfShape Shape  ) 

Get the orientation of a shape.

Parameters:
Shape : Shape to read
Returns:
Current rotation, in degrees

CSFML_API float sfShape_GetScaleX ( sfShape Shape  ) 

Get the horizontal scale of a shape.

Parameters:
Shape : Shape to read
Returns:
Current X scale factor (always positive)

CSFML_API float sfShape_GetScaleY ( sfShape Shape  ) 

Get the vertical scale of a shape.

Parameters:
Shape : Shape to read
Returns:
Current Y scale factor (always positive)

CSFML_API float sfShape_GetX ( sfShape Shape  ) 

Get the X position of a shape.

Parameters:
Shape : Shape to read
Returns:
Current X position

CSFML_API float sfShape_GetY ( sfShape Shape  ) 

Get the Y position of a shape.

Parameters:
Shape : Shape to read
Returns:
Current Y position

CSFML_API void sfShape_Move ( sfShape Shape,
float  OffsetX,
float  OffsetY 
)

Move a shape.

Parameters:
Shape : Shape to modify
OffsetX : Offset on the X axis
OffsetY : Offset on the Y axis

CSFML_API void sfShape_Rotate ( sfShape Shape,
float  Angle 
)

Rotate a shape.

Parameters:
Shape : Shape to modify
Angle : Angle of rotation, in degrees

CSFML_API void sfShape_Scale ( sfShape Shape,
float  FactorX,
float  FactorY 
)

Scale a shape.

Parameters:
Shape : Shape to modify
FactorX : Horizontal scaling factor (must be strictly positive)
FactorY : Vertical scaling factor (must be strictly positive)

CSFML_API void sfShape_SetBlendMode ( sfShape Shape,
sfBlendMode  Mode 
)

Set the blending mode for a shape.

Parameters:
Shape : Shape to modify
Mode : New blending mode

CSFML_API void sfShape_SetCenter ( sfShape Shape,
float  X,
float  Y 
)

Set the center of a shape, in coordinates relative to its left-top corner.

Parameters:
Shape : Shape to modify
X : X coordinate of the center
Y : Y coordinate of the center

CSFML_API void sfShape_SetColor ( sfShape Shape,
sfColor  Color 
)

Set the color of a shape.

Parameters:
Shape : Shape to modify
Color : New color

CSFML_API void sfShape_SetOutlineWidth ( sfShape Shape,
float  Width 
)

Change the width of a shape outline.

Parameters:
Shape : Shape to modify
Width : New width

CSFML_API void sfShape_SetPointColor ( sfShape Shape,
unsigned int  Index,
sfColor  Color 
)

Set a the color of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
Color : Color of the point

CSFML_API void sfShape_SetPointOutlineColor ( sfShape Shape,
unsigned int  Index,
sfColor  Color 
)

Set a the outline color of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
Color : Outline color of the point

CSFML_API void sfShape_SetPointPosition ( sfShape Shape,
unsigned int  Index,
float  X,
float  Y 
)

Set a the position of a shape's point.

Parameters:
Shape : Shape to read
Index : Index of the point to get
X : X coordinate of the point
Y : Y coordinate of the point

CSFML_API void sfShape_SetPosition ( sfShape Shape,
float  X,
float  Y 
)

Set the position of a shape.

Parameters:
Shape : Shape to modify
X : New X coordinate
Y : New Y coordinate

CSFML_API void sfShape_SetRotation ( sfShape Shape,
float  Rotation 
)

Set the orientation of a shape.

Parameters:
Shape : Shape to modify
Rotation : Angle of rotation, in degrees

CSFML_API void sfShape_SetScale ( sfShape Shape,
float  ScaleX,
float  ScaleY 
)

Set the scale of a shape.

Parameters:
Shape : Shape to modify
ScaleX : New horizontal scale (must be strictly positive)
ScaleY : New vertical scale (must be strictly positive)

CSFML_API void sfShape_SetScaleX ( sfShape Shape,
float  Scale 
)

Set the horizontal scale of a shape.

Parameters:
Shape : Shape to modify
Scale : New scale (must be strictly positive)

CSFML_API void sfShape_SetScaleY ( sfShape Shape,
float  Scale 
)

Set the vertical scale of a shape.

Parameters:
Shape : Shape to modify
Scale : New scale (must be strictly positive)

CSFML_API void sfShape_SetX ( sfShape Shape,
float  X 
)

Set the X position of a shape.

Parameters:
Shape : Shape to modify
X : New X coordinate

CSFML_API void sfShape_SetY ( sfShape Shape,
float  Y 
)

Set the Y position of a shape.

Parameters:
Shape : Shape to modify
Y : New Y coordinate

CSFML_API void sfShape_TransformToGlobal ( sfShape Shape,
float  PointX,
float  PointY,
float *  X,
float *  Y 
)

Transform a point from the shape's local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point).

Parameters:
Shape : Shape object
PointX : X coordinate of the point to transform
PointY : Y coordinate of the point to transform
X : Value to fill with the X coordinate of the converted point
Y : Value to fill with the y coordinate of the converted point

CSFML_API void sfShape_TransformToLocal ( sfShape Shape,
float  PointX,
float  PointY,
float *  X,
float *  Y 
)

Transform a point from global coordinates into the shape's local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point).

Parameters:
Shape : Shape object
PointX : X coordinate of the point to transform
PointY : Y coordinate of the point to transform
X : Value to fill with the X coordinate of the converted point
Y : Value to fill with the y coordinate of the converted point