String.h File Reference

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

Go to the source code of this file.


Typedefs

typedef sfString sfString
 sfString defines a graphical 2D text, that can be drawn on screen

Enumerations

enum  sfStringStyle {
  sfStringRegular = 0,
  sfStringBold = 1 << 0,
  sfStringItalic = 1 << 1,
  sfStringUnderlined = 1 << 2
}
 sfString styles More...

Functions

CSFML_API sfStringsfString_Create ()
 Create a new string.
CSFML_API void sfString_Destroy (sfString *String)
 Destroy an existing string.
CSFML_API void sfString_SetX (sfString *String, float X)
 Set the X position of a string.
CSFML_API void sfString_SetY (sfString *String, float Y)
 Set the Y position of a string.
CSFML_API void sfString_SetPosition (sfString *String, float Left, float Top)
 Set the position of a string.
CSFML_API void sfString_SetScaleX (sfString *String, float Scale)
 Set the horizontal scale of a string.
CSFML_API void sfString_SetScaleY (sfString *String, float Scale)
 Set the vertical scale of a string.
CSFML_API void sfString_SetScale (sfString *String, float ScaleX, float ScaleY)
 Set the scale of a string.
CSFML_API void sfString_SetRotation (sfString *String, float Rotation)
 Set the orientation of a string.
CSFML_API void sfString_SetCenter (sfString *String, float X, float Y)
 Set the center of a string, in coordinates relative to its left-top corner.
CSFML_API void sfString_SetColor (sfString *String, sfColor Color)
 Set the color of a string.
CSFML_API void sfString_SetBlendMode (sfString *String, sfBlendMode Mode)
 Set the blending mode for a string.
CSFML_API float sfString_GetX (sfString *String)
 Get the X position of a string.
CSFML_API float sfString_GetY (sfString *String)
 Get the top Y of a string.
CSFML_API float sfString_GetScaleX (sfString *String)
 Get the horizontal scale of a string.
CSFML_API float sfString_GetScaleY (sfString *String)
 Get the vertical scale of a string.
CSFML_API float sfString_GetRotation (sfString *String)
 Get the orientation of a string.
CSFML_API float sfString_GetCenterX (sfString *String)
 Get the X position of the center a string.
CSFML_API float sfString_GetCenterY (sfString *String)
 Get the top Y of the center of a string.
CSFML_API sfColor sfString_GetColor (sfString *String)
 Get the color of a string.
CSFML_API sfBlendMode sfString_GetBlendMode (sfString *String)
 Get the current blending mode of a string.
CSFML_API void sfString_Move (sfString *String, float OffsetX, float OffsetY)
 Move a string.
CSFML_API void sfString_Scale (sfString *String, float FactorX, float FactorY)
 Scale a string.
CSFML_API void sfString_Rotate (sfString *String, float Angle)
 Rotate a string.
CSFML_API void sfString_TransformToLocal (sfString *String, float PointX, float PointY, float *X, float *Y)
 Transform a point from global coordinates into the string's local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point).
CSFML_API void sfString_TransformToGlobal (sfString *String, float PointX, float PointY, float *X, float *Y)
 Transform a point from the string's local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point).
CSFML_API void sfString_SetText (sfString *String, const char *Text)
 Set the text of a string (from a multibyte string).
CSFML_API void sfString_SetUnicodeText (sfString *String, const sfUint32 *Text)
 Set the text of a string (from a unicode string).
CSFML_API void sfString_SetFont (sfString *String, sfFont *Font)
 Set the font of a string.
CSFML_API void sfString_SetSize (sfString *String, float Size)
 Set the size of a string.
CSFML_API void sfString_SetStyle (sfString *String, unsigned long Style)
 Set the style of a string.
CSFML_API const sfUint32 * sfString_GetUnicodeText (sfString *String)
 Get the text of a string (returns a unicode string).
CSFML_API const char * sfString_GetText (sfString *String)
 Get the text of a string (returns an ANSI string).
CSFML_API sfFontsfString_GetFont (sfString *String)
 Get the font used by a string.
CSFML_API float sfString_GetSize (sfString *String)
 Get the size of the characters of a string.
CSFML_API unsigned long sfString_GetStyle (sfString *String)
 Get the style of a string.
CSFML_API void sfString_GetCharacterPos (sfString *String, size_t Index, float *X, float *Y)
 Return the visual position of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied).
CSFML_API sfFloatRectsfString_GetRect (sfString *String)
 Get the bounding rectangle of a string on screen.

Typedef Documentation

typedef struct sfString sfString

sfString defines a graphical 2D text, that can be drawn on screen

Definition at line 41 of file String.h.


Enumeration Type Documentation

enum sfStringStyle

sfString styles

Enumerator:
sfStringRegular  Regular characters, no style.
sfStringBold  Characters are bold.
sfStringItalic  Characters are in italic.
sfStringUnderlined  Characters are underlined.

Definition at line 47 of file String.h.


Function Documentation

CSFML_API sfString* sfString_Create (  ) 

Create a new string.

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

CSFML_API void sfString_Destroy ( sfString String  ) 

Destroy an existing string.

Parameters:
String : String to delete

CSFML_API sfBlendMode sfString_GetBlendMode ( sfString String  ) 

Get the current blending mode of a string.

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

CSFML_API float sfString_GetCenterX ( sfString String  ) 

Get the X position of the center a string.

Parameters:
String : String to read
Returns:
Current X center position

CSFML_API float sfString_GetCenterY ( sfString String  ) 

Get the top Y of the center of a string.

Parameters:
String : String to read
Returns:
Current Y center position

CSFML_API void sfString_GetCharacterPos ( sfString String,
size_t  Index,
float *  X,
float *  Y 
)

Return the visual position of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied).

Parameters:
String : String to read
Index : Index of the character
X : Value to fill with the X coordinate of the position
Y : Value to fill with the y coordinate of the position

CSFML_API sfColor sfString_GetColor ( sfString String  ) 

Get the color of a string.

Parameters:
String : String to read
Returns:
Current color

CSFML_API sfFont* sfString_GetFont ( sfString String  ) 

Get the font used by a string.

Parameters:
String : String to read
Returns:
Pointer to the font

CSFML_API sfFloatRect* sfString_GetRect ( sfString String  ) 

Get the bounding rectangle of a string on screen.

Parameters:
String : String to read
Returns:
Rectangle contaning the string in screen coordinates

CSFML_API float sfString_GetRotation ( sfString String  ) 

Get the orientation of a string.

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

CSFML_API float sfString_GetScaleX ( sfString String  ) 

Get the horizontal scale of a string.

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

CSFML_API float sfString_GetScaleY ( sfString String  ) 

Get the vertical scale of a string.

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

CSFML_API float sfString_GetSize ( sfString String  ) 

Get the size of the characters of a string.

Parameters:
String : String to read
Returns:
Size of the characters

CSFML_API unsigned long sfString_GetStyle ( sfString String  ) 

Get the style of a string.

Parameters:
String : String to read
Returns:
Current string style (see sfStringStyle enum)

CSFML_API const char* sfString_GetText ( sfString String  ) 

Get the text of a string (returns an ANSI string).

Parameters:
String : String to read
Returns:
Text an a locale-dependant ANSI string

CSFML_API const sfUint32* sfString_GetUnicodeText ( sfString String  ) 

Get the text of a string (returns a unicode string).

Parameters:
String : String to read
Returns:
Text as UTF-32

CSFML_API float sfString_GetX ( sfString String  ) 

Get the X position of a string.

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

CSFML_API float sfString_GetY ( sfString String  ) 

Get the top Y of a string.

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

CSFML_API void sfString_Move ( sfString String,
float  OffsetX,
float  OffsetY 
)

Move a string.

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

CSFML_API void sfString_Rotate ( sfString String,
float  Angle 
)

Rotate a string.

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

CSFML_API void sfString_Scale ( sfString String,
float  FactorX,
float  FactorY 
)

Scale a string.

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

CSFML_API void sfString_SetBlendMode ( sfString String,
sfBlendMode  Mode 
)

Set the blending mode for a string.

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

CSFML_API void sfString_SetCenter ( sfString String,
float  X,
float  Y 
)

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

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

CSFML_API void sfString_SetColor ( sfString String,
sfColor  Color 
)

Set the color of a string.

Parameters:
String : String to modify
Color : New color

CSFML_API void sfString_SetFont ( sfString String,
sfFont Font 
)

Set the font of a string.

Parameters:
String : String to modify
Font : Font to use

CSFML_API void sfString_SetPosition ( sfString String,
float  Left,
float  Top 
)

Set the position of a string.

Parameters:
String : String to modify
Left : New left coordinate
Top : New top coordinate

CSFML_API void sfString_SetRotation ( sfString String,
float  Rotation 
)

Set the orientation of a string.

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

CSFML_API void sfString_SetScale ( sfString String,
float  ScaleX,
float  ScaleY 
)

Set the scale of a string.

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

CSFML_API void sfString_SetScaleX ( sfString String,
float  Scale 
)

Set the horizontal scale of a string.

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

CSFML_API void sfString_SetScaleY ( sfString String,
float  Scale 
)

Set the vertical scale of a string.

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

CSFML_API void sfString_SetSize ( sfString String,
float  Size 
)

Set the size of a string.

Parameters:
String : String to modify
Size : New size, in pixels

CSFML_API void sfString_SetStyle ( sfString String,
unsigned long  Style 
)

Set the style of a string.

Parameters:
String : String to modify
Size : New style (see sfStringStyle enum)

CSFML_API void sfString_SetText ( sfString String,
const char *  Text 
)

Set the text of a string (from a multibyte string).

Parameters:
String : String to modify
Text : New text

CSFML_API void sfString_SetUnicodeText ( sfString String,
const sfUint32 *  Text 
)

Set the text of a string (from a unicode string).

Parameters:
String : String to modify
Text : New text

CSFML_API void sfString_SetX ( sfString String,
float  X 
)

Set the X position of a string.

Parameters:
String : String to modify
X : New X coordinate

CSFML_API void sfString_SetY ( sfString String,
float  Y 
)

Set the Y position of a string.

Parameters:
String : String to modify
Y : New Y coordinate

CSFML_API void sfString_TransformToGlobal ( sfString String,
float  PointX,
float  PointY,
float *  X,
float *  Y 
)

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

Parameters:
String : String 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 sfString_TransformToLocal ( sfString String,
float  PointX,
float  PointY,
float *  X,
float *  Y 
)

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

Parameters:
String : String 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