FS#90 - Improve Unicode string classes
Added the sf::String class to replace (and enhance) sf::Unicode::Text FS#138 - Rename sf::String to sf::Text git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1286 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
9f063921c9
commit
78247bd386
46 changed files with 3003 additions and 1725 deletions
|
@ -318,15 +318,15 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Graphics\String.cpp"
|
||||
RelativePath="..\..\src\SFML\Graphics\Text.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Graphics\String.h"
|
||||
RelativePath="..\..\include\SFML\Graphics\Text.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Graphics\StringStruct.h"
|
||||
RelativePath="..\..\src\SFML\Graphics\TextStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
|
@ -313,15 +313,15 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Graphics\String.cpp"
|
||||
RelativePath="..\..\src\SFML\Graphics\Text.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Graphics\String.h"
|
||||
RelativePath="..\..\include\SFML\Graphics\Text.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Graphics\StringStruct.h"
|
||||
RelativePath="..\..\src\SFML\Graphics\TextStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
|
@ -59,12 +59,12 @@
|
|||
<Unit filename="..\..\include\SFML\Graphics\Color.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Font.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Image.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Shader.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Rect.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\RenderWindow.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Shader.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Shape.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Sprite.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\String.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Text.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\Types.h" />
|
||||
<Unit filename="..\..\include\SFML\Graphics\View.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Color.cpp" />
|
||||
|
@ -72,19 +72,20 @@
|
|||
<Unit filename="..\..\src\SFML\Graphics\FontStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Image.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\ImageStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Shader.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\ShaderStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Rect.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\RenderImage.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\RenderImageStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\RenderWindow.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\RenderWindowStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Shader.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\ShaderStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Shape.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\ShapeStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Sprite.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\SpriteStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\String.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\StringStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\Text.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\TextStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\View.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Graphics\ViewStruct.h" />
|
||||
<Extensions>
|
||||
|
|
|
@ -112,25 +112,25 @@ CSFML_API void sfRenderImage_Display(sfRenderImage* renderImage);
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / string / shape : Object to draw
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite);
|
||||
CSFML_API void sfRenderImage_DrawShape (sfRenderImage* renderImage, sfShape* shape);
|
||||
CSFML_API void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string);
|
||||
CSFML_API void sfRenderImage_DrawText (sfRenderImage* renderImage, sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderimage with a shader
|
||||
///
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / string / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, sfSprite* sprite, sfShader* shader);
|
||||
CSFML_API void sfRenderImage_DrawShapeWithShader (sfRenderImage* renderImage, sfShape* shape, sfShader* shader);
|
||||
CSFML_API void sfRenderImage_DrawStringWithShader(sfRenderImage* renderImage, sfString* string, sfShader* shader);
|
||||
CSFML_API void sfRenderImage_DrawTextWithShader (sfRenderImage* renderImage, sfText* text, sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the renderimage with the given color
|
||||
|
|
|
@ -292,25 +292,25 @@ CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow,
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / string / shape : Object to draw
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite);
|
||||
CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* renderWindow, sfShape* shape);
|
||||
CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string);
|
||||
CSFML_API void sfRenderWindow_DrawText (sfRenderWindow* renderWindow, sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderwindow with a shader
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / string / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, sfSprite* sprite, sfShader* shader);
|
||||
CSFML_API void sfRenderWindow_DrawShapeWithShader (sfRenderWindow* renderWindow, sfShape* shape, sfShader* shader);
|
||||
CSFML_API void sfRenderWindow_DrawStringWithShader(sfRenderWindow* renderWindow, sfString* string, sfShader* shader);
|
||||
CSFML_API void sfRenderWindow_DrawTextWithShader (sfRenderWindow* renderWindow, sfText* text, sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the screen with the given color
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_STRING_H
|
||||
#define SFML_STRING_H
|
||||
#ifndef SFML_TEXT_H
|
||||
#define SFML_TEXT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
|
@ -36,389 +36,389 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfString styles
|
||||
/// sfText styles
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStringRegular = 0, ///< Regular characters, no style
|
||||
sfStringBold = 1 << 0, ///< Characters are bold
|
||||
sfStringItalic = 1 << 1, ///< Characters are in italic
|
||||
sfStringUnderlined = 1 << 2 ///< Characters are underlined
|
||||
} sfStringStyle;
|
||||
sfTextRegular = 0, ///< Regular characters, no style
|
||||
sfTextBold = 1 << 0, ///< Characters are bold
|
||||
sfTextItalic = 1 << 1, ///< Characters are in italic
|
||||
sfTextUnderlined = 1 << 2 ///< Characters are underlined
|
||||
} sfTextStyle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new string
|
||||
/// Create a new text
|
||||
///
|
||||
/// \return A new sfString object, or NULL if it failed
|
||||
/// \return A new sfText object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfString* sfString_Create();
|
||||
CSFML_API sfText* sfText_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing string
|
||||
/// Destroy an existing text
|
||||
///
|
||||
/// \param string : String to delete
|
||||
/// \param text : Text to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Destroy(sfString* string);
|
||||
CSFML_API void sfText_Destroy(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a string
|
||||
/// Set the X position of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param text : String to modify
|
||||
/// \param x : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetX(sfString* string, float x);
|
||||
CSFML_API void sfText_SetX(sfText* text, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of a string
|
||||
/// Set the Y position of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param y : New Y coordinate
|
||||
/// \param text : String to modify
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetY(sfString* string, float y);
|
||||
CSFML_API void sfText_SetY(sfText* text, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a string
|
||||
/// Set the position of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
/// \param text : String to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetPosition(sfString* string, float x, float y);
|
||||
CSFML_API void sfText_SetPosition(sfText* text, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a string
|
||||
/// Set the horizontal scale of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
/// \param text : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScaleX(sfString* string, float scale);
|
||||
CSFML_API void sfText_SetScaleX(sfText* text, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a string
|
||||
/// Set the vertical scale of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
/// \param text : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScaleY(sfString* string, float scale);
|
||||
CSFML_API void sfText_SetScaleY(sfText* text, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a string
|
||||
/// Set the scale of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : String to modify
|
||||
/// \param scaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param scaleY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScale(sfString* string, float scaleX, float scaleY);
|
||||
CSFML_API void sfText_SetScale(sfText* text, float scaleX, float scaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a string
|
||||
/// Set the orientation of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : String to modify
|
||||
/// \param rotation : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetRotation(sfString* string, float rotation);
|
||||
CSFML_API void sfText_SetRotation(sfText* text, float rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of a string, in coordinates
|
||||
/// Set the local origin of a text, in coordinates
|
||||
/// relative to its left-top corner
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
/// \param text : String to modify
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetOrigin(sfString* string, float x, float y);
|
||||
CSFML_API void sfText_SetOrigin(sfText* text, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a string
|
||||
/// Set the color of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param color : New color
|
||||
/// \param text : String to modify
|
||||
/// \param color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetColor(sfString* string, sfColor color);
|
||||
CSFML_API void sfText_SetColor(sfText* text, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a string
|
||||
/// Set the blending mode for a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param mode : New blending mode
|
||||
/// \param text : String to modify
|
||||
/// \param mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetBlendMode(sfString* string, sfBlendMode mode);
|
||||
CSFML_API void sfText_SetBlendMode(sfText* text, sfBlendMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a string
|
||||
/// Get the X position of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetX(sfString* string);
|
||||
CSFML_API float sfText_GetX(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of a string
|
||||
/// Get the top Y of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetY(sfString* string);
|
||||
CSFML_API float sfText_GetY(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a string
|
||||
/// Get the horizontal scale of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetScaleX(sfString* string);
|
||||
CSFML_API float sfText_GetScaleX(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a string
|
||||
/// Get the vertical scale of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetScaleY(sfString* string);
|
||||
CSFML_API float sfText_GetScaleY(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a string
|
||||
/// Get the orientation of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetRotation(sfString* string);
|
||||
CSFML_API float sfText_GetRotation(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the origin a string
|
||||
/// Get the X position of the origin a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetOriginX(sfString* string);
|
||||
CSFML_API float sfText_GetOriginX(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the origin of a string
|
||||
/// Get the top Y of the origin of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetOriginY(sfString* string);
|
||||
CSFML_API float sfText_GetOriginY(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a string
|
||||
/// Get the color of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfString_GetColor(sfString* string);
|
||||
CSFML_API sfColor sfText_GetColor(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a string
|
||||
/// Get the current blending mode of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfString_GetBlendMode(sfString* string);
|
||||
CSFML_API sfBlendMode sfText_GetBlendMode(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a string
|
||||
/// Move a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : String to modify
|
||||
/// \param offsetX : Offset on the X axis
|
||||
/// \param offsetY : Offset on the Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Move(sfString* string, float offsetX, float offsetY);
|
||||
CSFML_API void sfText_Move(sfText* text, float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a string
|
||||
/// Scale a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : String to modify
|
||||
/// \param factorX : Horizontal scaling factor (must be strictly positive)
|
||||
/// \param factorY : Vertical scaling factor (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Scale(sfString* string, float factorX, float factorY);
|
||||
CSFML_API void sfText_Scale(sfText* text, float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a string
|
||||
/// Rotate a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
/// \param text : String to modify
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Rotate(sfString* string, float angle);
|
||||
CSFML_API void sfText_Rotate(sfText* text, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param string : String object
|
||||
/// \param text : String object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param 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);
|
||||
CSFML_API void sfText_TransformToLocal(sfText* text, 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 origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param string : String object
|
||||
/// \param text : String object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_TransformToGlobal(sfString* string, float pointX, float pointY, float* X, float* y);
|
||||
CSFML_API void sfText_TransformToGlobal(sfText* text, float pointX, float pointY, float* X, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a multibyte string)
|
||||
/// Set the string of a text (from a multibyte string)
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : New text
|
||||
/// \param text : Text to modify
|
||||
/// \param string : New string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetText(sfString* string, const char* text);
|
||||
CSFML_API void sfText_SetString(sfText* text, const char* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a unicode string)
|
||||
/// Set the string of a text (from a unicode string)
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param text : New text
|
||||
/// \param text : Text to modify
|
||||
/// \param string : New string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetUnicodeText(sfString* string, const sfUint32* text);
|
||||
CSFML_API void sfText_SetUnicodeString(sfText* text, const sfUint32* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the font of a string
|
||||
/// Set the font of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param font : Font to use
|
||||
/// \param text : String to modify
|
||||
/// \param font : Font to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetFont(sfString* string, sfFont* font);
|
||||
CSFML_API void sfText_SetFont(sfText* text, sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the size of a string
|
||||
/// Set the size of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param size : New size, in pixels
|
||||
/// \param text : String to modify
|
||||
/// \param size : New size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetSize(sfString* string, float size);
|
||||
CSFML_API void sfText_SetSize(sfText* text, float size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the style of a string
|
||||
/// Set the style of a text
|
||||
///
|
||||
/// \param string : String to modify
|
||||
/// \param style : New style (see sfStringStyle enum)
|
||||
/// \param text : String to modify
|
||||
/// \param style : New style (see sfTextStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetStyle(sfString* string, unsigned long style);
|
||||
CSFML_API void sfText_SetStyle(sfText* text, unsigned long style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns a unicode string)
|
||||
/// Get the string of a text (returns a unicode string)
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Text as UTF-32
|
||||
/// \return String as UTF-32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfUint32* sfString_GetUnicodeText(sfString* string);
|
||||
CSFML_API const sfUint32* sfText_GetUnicodeString(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns an ANSI string)
|
||||
/// Get the text of a text (returns an ANSI string)
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Text an a locale-dependant ANSI string
|
||||
/// \return String an a locale-dependant ANSI string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfString_GetText(sfString* string);
|
||||
CSFML_API const char* sfText_GetString(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the font used by a string
|
||||
/// Get the font used by a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Pointer to the font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfString_GetFont(sfString* string);
|
||||
CSFML_API sfFont* sfText_GetFont(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the characters of a string
|
||||
/// Get the size of the characters of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Size of the characters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetSize(sfString* string);
|
||||
CSFML_API float sfText_GetSize(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the style of a string
|
||||
/// Get the style of a text
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current string style (see sfStringStyle enum)
|
||||
/// \return Current string style (see sfTextStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned long sfString_GetStyle(sfString* string);
|
||||
CSFML_API unsigned long sfText_GetStyle(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// Return the visual position of the Index-th character of the text,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param index : Index of the character
|
||||
/// \param x : Value to fill with the X coordinate of the position
|
||||
/// \param y : Value to fill with the y coordinate of the position
|
||||
/// \param text : String to read
|
||||
/// \param index : Index of the character
|
||||
/// \param x : Value to fill with the X coordinate of the position
|
||||
/// \param y : Value to fill with the y coordinate of the position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_GetCharacterPos(sfString* string, size_t index, float* x, float* y);
|
||||
CSFML_API void sfText_GetCharacterPos(sfText* text, size_t index, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the bounding rectangle of a string on screen
|
||||
/// Get the bounding rectangle of a text on screen
|
||||
///
|
||||
/// \param string : String to read
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Rectangle contaning the string in screen coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFloatRect sfString_GetRect(sfString* string);
|
||||
CSFML_API sfFloatRect sfText_GetRect(sfText* text);
|
||||
|
||||
|
||||
#endif // SFML_STRING_H
|
||||
#endif // SFML_TEXT_H
|
|
@ -33,7 +33,7 @@ typedef struct sfRenderImage sfRenderImage;
|
|||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
typedef struct sfShape sfShape;
|
||||
typedef struct sfSprite sfSprite;
|
||||
typedef struct sfString sfString;
|
||||
typedef struct sfText sfText;
|
||||
typedef struct sfView sfView;
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <SFML/Graphics/ShapeStruct.h>
|
||||
#include <SFML/Graphics/ShaderStruct.h>
|
||||
#include <SFML/Graphics/SpriteStruct.h>
|
||||
#include <SFML/Graphics/StringStruct.h>
|
||||
#include <SFML/Graphics/TextStruct.h>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
|
@ -128,10 +128,10 @@ void sfRenderImage_DrawShape(sfRenderImage* renderImage, sfShape* shape)
|
|||
CSFML_CHECK(shape);
|
||||
CSFML_CALL(renderImage, Draw(shape->This));
|
||||
}
|
||||
void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string)
|
||||
void sfRenderImage_DrawText(sfRenderImage* renderImage, sfText* text)
|
||||
{
|
||||
CSFML_CHECK(string);
|
||||
CSFML_CALL(renderImage, Draw(string->This));
|
||||
CSFML_CHECK(text);
|
||||
CSFML_CALL(renderImage, Draw(text->This));
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,11 +150,11 @@ void sfRenderImage_DrawShapeWithShader(sfRenderImage* renderImage, sfShape* shap
|
|||
CSFML_CHECK(shader);
|
||||
CSFML_CALL(renderImage, Draw(shape->This, shader->This));
|
||||
}
|
||||
void sfRenderImage_DrawStringWithShader(sfRenderImage* renderImage, sfString* string, sfShader* shader)
|
||||
void sfRenderImage_DrawTextWithShader(sfRenderImage* renderImage, sfText* text, sfShader* shader)
|
||||
{
|
||||
CSFML_CHECK(string);
|
||||
CSFML_CHECK(text);
|
||||
CSFML_CHECK(shader);
|
||||
CSFML_CALL(renderImage, Draw(string->This, shader->This));
|
||||
CSFML_CALL(renderImage, Draw(text->This, shader->This));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <SFML/Graphics/ShaderStruct.h>
|
||||
#include <SFML/Graphics/ImageStruct.h>
|
||||
#include <SFML/Graphics/SpriteStruct.h>
|
||||
#include <SFML/Graphics/StringStruct.h>
|
||||
#include <SFML/Graphics/TextStruct.h>
|
||||
#include <SFML/Internal.h>
|
||||
#include <SFML/ConvertEvent.h>
|
||||
|
||||
|
@ -366,10 +366,10 @@ void sfRenderWindow_DrawShape(sfRenderWindow* renderWindow, sfShape* shape)
|
|||
CSFML_CHECK(shape);
|
||||
CSFML_CALL(renderWindow, Draw(shape->This));
|
||||
}
|
||||
void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string)
|
||||
void sfRenderWindow_DrawText(sfRenderWindow* renderWindow, sfText* text)
|
||||
{
|
||||
CSFML_CHECK(string);
|
||||
CSFML_CALL(renderWindow, Draw(string->This));
|
||||
CSFML_CHECK(text);
|
||||
CSFML_CALL(renderWindow, Draw(text->This));
|
||||
}
|
||||
|
||||
|
||||
|
@ -388,11 +388,11 @@ void sfRenderWindow_DrawShapeWithShader(sfRenderWindow* renderWindow, sfShape* s
|
|||
CSFML_CHECK(shader);
|
||||
CSFML_CALL(renderWindow, Draw(shape->This, shader->This));
|
||||
}
|
||||
void sfRenderWindow_DrawStringWithShader(sfRenderWindow* renderWindow, sfString* string, sfShader* shader)
|
||||
void sfRenderWindow_DrawTextWithShader(sfRenderWindow* renderWindow, sfText* text, sfShader* shader)
|
||||
{
|
||||
CSFML_CHECK(string);
|
||||
CSFML_CHECK(text);
|
||||
CSFML_CHECK(shader);
|
||||
CSFML_CALL(renderWindow, Draw(string->This, shader->This));
|
||||
CSFML_CALL(renderWindow, Draw(text->This, shader->This));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,397 +25,397 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/String.h>
|
||||
#include <SFML/Graphics/StringStruct.h>
|
||||
#include <SFML/Graphics/Text.h>
|
||||
#include <SFML/Graphics/TextStruct.h>
|
||||
#include <SFML/Graphics/Font.h>
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new string
|
||||
/// Create a new text
|
||||
////////////////////////////////////////////////////////////
|
||||
sfString* sfString_Create()
|
||||
sfText* sfText_Create()
|
||||
{
|
||||
sfString* string = new sfString;
|
||||
string->Font = sfFont_GetDefaultFont();
|
||||
sfText* text = new sfText;
|
||||
text->Font = sfFont_GetDefaultFont();
|
||||
|
||||
return string;
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing string
|
||||
/// Destroy an existing text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_Destroy(sfString* string)
|
||||
void sfText_Destroy(sfText* text)
|
||||
{
|
||||
delete string;
|
||||
delete text;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a string
|
||||
/// Set the X position of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetX(sfString* string, float x)
|
||||
void sfText_SetX(sfText* text, float x)
|
||||
{
|
||||
CSFML_CALL(string, SetX(x))
|
||||
CSFML_CALL(text, SetX(x))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of a string
|
||||
/// Set the Y position of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetY(sfString* string, float y)
|
||||
void sfText_SetY(sfText* text, float y)
|
||||
{
|
||||
CSFML_CALL(string, SetY(y))
|
||||
CSFML_CALL(text, SetY(y))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a string
|
||||
/// Set the position of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetPosition(sfString* string, float x, float y)
|
||||
void sfText_SetPosition(sfText* text, float x, float y)
|
||||
{
|
||||
CSFML_CALL(string, SetPosition(sf::Vector2f(x, y)))
|
||||
CSFML_CALL(text, SetPosition(sf::Vector2f(x, y)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a string
|
||||
/// Set the horizontal scale of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetScaleX(sfString* string, float scale)
|
||||
void sfText_SetScaleX(sfText* text, float scale)
|
||||
{
|
||||
CSFML_CALL(string, SetScaleX(scale))
|
||||
CSFML_CALL(text, SetScaleX(scale))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a string
|
||||
/// Set the vertical scale of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetScaleY(sfString* string, float scale)
|
||||
void sfText_SetScaleY(sfText* text, float scale)
|
||||
{
|
||||
CSFML_CALL(string, SetScaleY(scale))
|
||||
CSFML_CALL(text, SetScaleY(scale))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a string
|
||||
/// Set the scale of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetScale(sfString* string, float scaleX, float scaleY)
|
||||
void sfText_SetScale(sfText* text, float scaleX, float scaleY)
|
||||
{
|
||||
CSFML_CALL(string, SetScale(sf::Vector2f(scaleX, scaleY)))
|
||||
CSFML_CALL(text, SetScale(sf::Vector2f(scaleX, scaleY)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a string
|
||||
/// Set the orientation of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetRotation(sfString* string, float rotation)
|
||||
void sfText_SetRotation(sfText* text, float rotation)
|
||||
{
|
||||
CSFML_CALL(string, SetRotation(rotation))
|
||||
CSFML_CALL(text, SetRotation(rotation))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of a string, in coordinates
|
||||
/// Set the local origin of a text, in coordinates
|
||||
/// relative to its left-top corner
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetOrigin(sfString* string, float x, float y)
|
||||
void sfText_SetOrigin(sfText* text, float x, float y)
|
||||
{
|
||||
CSFML_CALL(string, SetOrigin(sf::Vector2f(x, y)))
|
||||
CSFML_CALL(text, SetOrigin(sf::Vector2f(x, y)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a string
|
||||
/// Set the color of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetColor(sfString* string, sfColor color)
|
||||
void sfText_SetColor(sfText* text, sfColor color)
|
||||
{
|
||||
CSFML_CALL(string, SetColor(sf::Color(color.r, color.g, color.b, color.a)))
|
||||
CSFML_CALL(text, SetColor(sf::Color(color.r, color.g, color.b, color.a)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a string
|
||||
/// Set the blending mode for a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetBlendMode(sfString* string, sfBlendMode mode)
|
||||
void sfText_SetBlendMode(sfText* text, sfBlendMode mode)
|
||||
{
|
||||
CSFML_CALL(string, SetBlendMode(static_cast<sf::Blend::Mode>(mode)))
|
||||
CSFML_CALL(text, SetBlendMode(static_cast<sf::Blend::Mode>(mode)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a string
|
||||
/// Get the X position of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetX(sfString* string)
|
||||
float sfText_GetX(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetPosition().x, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetPosition().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of a string
|
||||
/// Get the Y position of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetY(sfString* string)
|
||||
float sfText_GetY(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetPosition().y, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetPosition().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a string
|
||||
/// Get the horizontal scale of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetScaleX(sfString* string)
|
||||
float sfText_GetScaleX(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetScale().x, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetScale().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a string
|
||||
/// Get the vertical scale of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetScaleY(sfString* string)
|
||||
float sfText_GetScaleY(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetScale().y, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetScale().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a string
|
||||
/// Get the orientation of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetRotation(sfString* string)
|
||||
float sfText_GetRotation(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetRotation(), 0.f)
|
||||
CSFML_CALL_RETURN(text, GetRotation(), 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the origin a string
|
||||
/// Get the X position of the origin a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetOriginX(sfString* string)
|
||||
float sfText_GetOriginX(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetOrigin().x, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetOrigin().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the origin of a string
|
||||
/// Get the top Y of the origin of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetOriginY(sfString* string)
|
||||
float sfText_GetOriginY(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetOrigin().y, 0.f)
|
||||
CSFML_CALL_RETURN(text, GetOrigin().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a string
|
||||
/// Get the color of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
sfColor sfString_GetColor(sfString* string)
|
||||
sfColor sfText_GetColor(sfText* text)
|
||||
{
|
||||
sfColor color = {0, 0, 0, 0};
|
||||
CSFML_CHECK_RETURN(string, color)
|
||||
CSFML_CHECK_RETURN(text, color)
|
||||
|
||||
sf::Color SFMLColor = string->This.GetColor();
|
||||
sf::Color SFMLColor = text->This.GetColor();
|
||||
return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a string
|
||||
/// Get the current blending mode of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBlendMode sfString_GetBlendMode(sfString* string)
|
||||
sfBlendMode sfText_GetBlendMode(sfText* text)
|
||||
{
|
||||
CSFML_CHECK_RETURN(string, sfBlendNone)
|
||||
CSFML_CHECK_RETURN(text, sfBlendNone)
|
||||
|
||||
return static_cast<sfBlendMode>(string->This.GetBlendMode());
|
||||
return static_cast<sfBlendMode>(text->This.GetBlendMode());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a string
|
||||
/// Move a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_Move(sfString* string, float offsetX, float offsetY)
|
||||
void sfText_Move(sfText* text, float offsetX, float offsetY)
|
||||
{
|
||||
CSFML_CALL(string, Move(sf::Vector2f(offsetX, offsetY)))
|
||||
CSFML_CALL(text, Move(sf::Vector2f(offsetX, offsetY)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a string
|
||||
/// Scale a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_Scale(sfString* string, float factorX, float factorY)
|
||||
void sfText_Scale(sfText* text, float factorX, float factorY)
|
||||
{
|
||||
CSFML_CALL(string, Scale(sf::Vector2f(factorX, factorY)))
|
||||
CSFML_CALL(text, Scale(sf::Vector2f(factorX, factorY)))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a string
|
||||
/// Rotate a text
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_Rotate(sfString* string, float angle)
|
||||
void sfText_Rotate(sfText* text, float angle)
|
||||
{
|
||||
CSFML_CALL(string, Rotate(angle))
|
||||
CSFML_CALL(text, Rotate(angle))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// Transform a point from global coordinates into the text's local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_TransformToLocal(sfString* string, float pointX, float pointY, float* x, float* y)
|
||||
void sfText_TransformToLocal(sfText* text, float pointX, float pointY, float* x, float* y)
|
||||
{
|
||||
CSFML_CHECK(string)
|
||||
CSFML_CHECK(text)
|
||||
|
||||
sf::Vector2f point = string->This.TransformToLocal(sf::Vector2f(pointX, pointY));
|
||||
sf::Vector2f point = text->This.TransformToLocal(sf::Vector2f(pointX, pointY));
|
||||
if (x) *x = point.x;
|
||||
if (y) *y = point.y;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the string's local coordinates into global coordinates
|
||||
/// Transform a point from the text's local coordinates into global coordinates
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_TransformToGlobal(sfString* string, float pointX, float pointY, float* x, float* y)
|
||||
void sfText_TransformToGlobal(sfText* text, float pointX, float pointY, float* x, float* y)
|
||||
{
|
||||
CSFML_CHECK(string)
|
||||
CSFML_CHECK(text)
|
||||
|
||||
sf::Vector2f point = string->This.TransformToGlobal(sf::Vector2f(pointX, pointY));
|
||||
sf::Vector2f point = text->This.TransformToGlobal(sf::Vector2f(pointX, pointY));
|
||||
if (x) *x = point.x;
|
||||
if (y) *y = point.y;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a multibyte string)
|
||||
/// Set the string of a text (from a multibyte string)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetText(sfString* string, const char* text)
|
||||
void sfText_SetString(sfText* text, const char* string)
|
||||
{
|
||||
CSFML_CALL(string, SetText(text))
|
||||
CSFML_CALL(text, SetString(string))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a unicode string)
|
||||
/// Set the string of a text (from a unicode string)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetUnicodeText(sfString* string, const sfUint32* text)
|
||||
void sfText_SetUnicodeString(sfText* text, const sfUint32* string)
|
||||
{
|
||||
sf::Unicode::UTF32String UTF32Text = text;
|
||||
CSFML_CALL(string, SetText(UTF32Text))
|
||||
sf::String UTF32Text = string;
|
||||
CSFML_CALL(text, SetString(UTF32Text))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the font of a string
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetFont(sfString* string, sfFont* font)
|
||||
void sfText_SetFont(sfText* text, sfFont* font)
|
||||
{
|
||||
CSFML_CHECK(font);
|
||||
|
||||
CSFML_CALL(string, SetFont(font->This))
|
||||
string->Font = font;
|
||||
CSFML_CALL(text, SetFont(font->This))
|
||||
text->Font = font;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the size of a string
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetSize(sfString* string, float size)
|
||||
void sfText_SetSize(sfText* text, float size)
|
||||
{
|
||||
CSFML_CALL(string, SetSize(size))
|
||||
CSFML_CALL(text, SetSize(size))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the style of a string
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetStyle(sfString* string, unsigned long style)
|
||||
void sfText_SetStyle(sfText* text, unsigned long style)
|
||||
{
|
||||
CSFML_CALL(string, SetStyle(style))
|
||||
CSFML_CALL(text, SetStyle(style))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns a unicode string)
|
||||
/// Get the string of a text (returns a unicode string)
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfUint32* sfString_GetUnicodeText(sfString* string)
|
||||
const sfUint32* sfText_GetUnicodeString(sfText* text)
|
||||
{
|
||||
CSFML_CHECK_RETURN(string, NULL)
|
||||
CSFML_CHECK_RETURN(text, NULL)
|
||||
|
||||
return static_cast<const sf::Unicode::UTF32String&>(string->This.GetText()).c_str();
|
||||
return text->This.GetString().GetData();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns an ANSI string)
|
||||
/// Get the string of a text (returns an ANSI string)
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfString_GetText(sfString* string)
|
||||
const char* sfText_GetString(sfText* text)
|
||||
{
|
||||
CSFML_CHECK_RETURN(string, NULL)
|
||||
CSFML_CHECK_RETURN(text, NULL)
|
||||
|
||||
string->Text = string->This.GetText();
|
||||
text->String = text->This.GetString().ToAnsiString();
|
||||
|
||||
return string->Text.c_str();
|
||||
return text->String.c_str();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the font used by a string
|
||||
/// Get the font used by a text
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFont* sfString_GetFont(sfString* string)
|
||||
sfFont* sfText_GetFont(sfText* text)
|
||||
{
|
||||
CSFML_CHECK_RETURN(string, NULL)
|
||||
CSFML_CHECK_RETURN(text, NULL)
|
||||
|
||||
return string->Font;
|
||||
return text->Font;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the characters of a string
|
||||
/// Get the size of the characters of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetSize(sfString* string)
|
||||
float sfText_GetSize(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetSize(), 0.f)
|
||||
CSFML_CALL_RETURN(text, GetSize(), 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the style of a string
|
||||
/// Get the style of a text
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned long sfString_GetStyle(sfString* string)
|
||||
unsigned long sfText_GetStyle(sfText* text)
|
||||
{
|
||||
CSFML_CALL_RETURN(string, GetStyle(), 0)
|
||||
CSFML_CALL_RETURN(text, GetStyle(), 0)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// in coordinates relative to the string
|
||||
/// Return the visual position of the Index-th character of the text,
|
||||
/// in coordinates relative to the text
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_GetCharacterPos(sfString* string, size_t index, float* x, float* y)
|
||||
void sfText_GetCharacterPos(sfText* text, size_t index, float* x, float* y)
|
||||
{
|
||||
CSFML_CHECK(string);
|
||||
CSFML_CHECK(text);
|
||||
|
||||
sf::Vector2f pos = string->This.GetCharacterPos(index);
|
||||
sf::Vector2f pos = text->This.GetCharacterPos(index);
|
||||
if (x) *x = pos.x;
|
||||
if (y) *y = pos.y;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the bounding rectangle of a string on screen
|
||||
/// Get the bounding rectangle of a text on screen
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFloatRect sfString_GetRect(sfString* string)
|
||||
sfFloatRect sfText_GetRect(sfText* text)
|
||||
{
|
||||
sfFloatRect rect = {0.f, 0.f, 0.f, 0.f};
|
||||
CSFML_CHECK_RETURN(string, rect)
|
||||
CSFML_CHECK_RETURN(text, rect)
|
||||
|
||||
sf::FloatRect SFMLRect = string->This.GetRect();
|
||||
string->Rect.Left = SFMLRect.Left;
|
||||
string->Rect.Top = SFMLRect.Top;
|
||||
string->Rect.Right = SFMLRect.Right;
|
||||
string->Rect.Bottom = SFMLRect.Bottom;
|
||||
sf::FloatRect SFMLRect = text->This.GetRect();
|
||||
text->Rect.Left = SFMLRect.Left;
|
||||
text->Rect.Top = SFMLRect.Top;
|
||||
text->Rect.Right = SFMLRect.Right;
|
||||
text->Rect.Bottom = SFMLRect.Bottom;
|
||||
|
||||
return string->Rect;
|
||||
return text->Rect;
|
||||
}
|
|
@ -22,28 +22,28 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_STRINGSTRUCT_H
|
||||
#define SFML_STRINGSTRUCT_H
|
||||
#ifndef SFML_TEXTSTRUCT_H
|
||||
#define SFML_TEXTSTRUCT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/String.hpp>
|
||||
#include <SFML/Graphics/Text.hpp>
|
||||
#include <SFML/Graphics/FontStruct.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of sfMusic
|
||||
// Internal structure of sfText
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfString
|
||||
struct sfText
|
||||
{
|
||||
sf::String This;
|
||||
std::string Text;
|
||||
sf::Text This;
|
||||
std::string String;
|
||||
sfFont* Font;
|
||||
sfFloatRect Rect;
|
||||
};
|
||||
|
||||
|
||||
#endif // SFML_STRINGSTRUCT_H
|
||||
#endif // SFML_TEXTSTRUCT_H
|
|
@ -130,44 +130,44 @@ EXPORTS
|
|||
sfFont_Destroy
|
||||
sfFont_GetCharacterSize
|
||||
sfFont_GetDefaultFont
|
||||
sfString_Create
|
||||
sfString_Destroy
|
||||
sfString_SetX
|
||||
sfString_SetY
|
||||
sfString_SetPosition
|
||||
sfString_SetScaleX
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
sfString_GetY
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
sfString_Scale
|
||||
sfString_Rotate
|
||||
sfString_TransformToLocal
|
||||
sfString_TransformToGlobal
|
||||
sfString_SetText
|
||||
sfString_SetUnicodeText
|
||||
sfString_SetFont
|
||||
sfString_SetSize
|
||||
sfString_SetStyle
|
||||
sfString_GetUnicodeText
|
||||
sfString_GetText
|
||||
sfString_GetFont
|
||||
sfString_GetSize
|
||||
sfString_GetStyle
|
||||
sfString_GetCharacterPos
|
||||
sfString_GetRect
|
||||
sfText_Create
|
||||
sfText_Destroy
|
||||
sfText_SetX
|
||||
sfText_SetY
|
||||
sfText_SetPosition
|
||||
sfText_SetScaleX
|
||||
sfText_SetScaleY
|
||||
sfText_SetScale
|
||||
sfText_SetRotation
|
||||
sfText_SetOrigin
|
||||
sfText_SetColor
|
||||
sfText_SetBlendMode
|
||||
sfText_GetX
|
||||
sfText_GetY
|
||||
sfText_GetScaleX
|
||||
sfText_GetScaleY
|
||||
sfText_GetRotation
|
||||
sfText_GetOriginX
|
||||
sfText_GetOriginY
|
||||
sfText_GetColor
|
||||
sfText_GetBlendMode
|
||||
sfText_Move
|
||||
sfText_Scale
|
||||
sfText_Rotate
|
||||
sfText_TransformToLocal
|
||||
sfText_TransformToGlobal
|
||||
sfText_SetString
|
||||
sfText_SetUnicodeString
|
||||
sfText_SetFont
|
||||
sfText_SetSize
|
||||
sfText_SetStyle
|
||||
sfText_GetUnicodeString
|
||||
sfText_GetString
|
||||
sfText_GetFont
|
||||
sfText_GetSize
|
||||
sfText_GetStyle
|
||||
sfText_GetCharacterPos
|
||||
sfText_GetRect
|
||||
sfRenderImage_Create
|
||||
sfRenderImage_Destroy
|
||||
sfRenderImage_GetWidth
|
||||
|
@ -177,10 +177,10 @@ EXPORTS
|
|||
sfRenderImage_Display
|
||||
sfRenderImage_DrawSprite
|
||||
sfRenderImage_DrawShape
|
||||
sfRenderImage_DrawString
|
||||
sfRenderImage_DrawText
|
||||
sfRenderImage_DrawSpriteWithShader
|
||||
sfRenderImage_DrawShapeWithShader
|
||||
sfRenderImage_DrawStringWithShader
|
||||
sfRenderImage_DrawTextWithShader
|
||||
sfRenderImage_Clear
|
||||
sfRenderImage_SetView
|
||||
sfRenderImage_GetView
|
||||
|
@ -213,10 +213,10 @@ EXPORTS
|
|||
sfRenderWindow_GetFrameTime
|
||||
sfRenderWindow_SetJoystickThreshold
|
||||
sfRenderWindow_DrawSprite
|
||||
sfRenderWindow_DrawString
|
||||
sfRenderWindow_DrawText
|
||||
sfRenderWindow_DrawShape
|
||||
sfRenderWindow_DrawSpriteWithShader
|
||||
sfRenderWindow_DrawStringWithShader
|
||||
sfRenderWindow_DrawTextWithShader
|
||||
sfRenderWindow_DrawShapeWithShader
|
||||
sfRenderWindow_Clear
|
||||
sfRenderWindow_SetView
|
||||
|
|
|
@ -130,44 +130,44 @@ EXPORTS
|
|||
sfFont_Destroy
|
||||
sfFont_GetCharacterSize
|
||||
sfFont_GetDefaultFont
|
||||
sfString_Create
|
||||
sfString_Destroy
|
||||
sfString_SetX
|
||||
sfString_SetY
|
||||
sfString_SetPosition
|
||||
sfString_SetScaleX
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
sfString_GetY
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
sfString_Scale
|
||||
sfString_Rotate
|
||||
sfString_TransformToLocal
|
||||
sfString_TransformToGlobal
|
||||
sfString_SetText
|
||||
sfString_SetUnicodeText
|
||||
sfString_SetFont
|
||||
sfString_SetSize
|
||||
sfString_SetStyle
|
||||
sfString_GetUnicodeText
|
||||
sfString_GetText
|
||||
sfString_GetFont
|
||||
sfString_GetSize
|
||||
sfString_GetStyle
|
||||
sfString_GetCharacterPos
|
||||
sfString_GetRect
|
||||
sfText_Create
|
||||
sfText_Destroy
|
||||
sfText_SetX
|
||||
sfText_SetY
|
||||
sfText_SetPosition
|
||||
sfText_SetScaleX
|
||||
sfText_SetScaleY
|
||||
sfText_SetScale
|
||||
sfText_SetRotation
|
||||
sfText_SetOrigin
|
||||
sfText_SetColor
|
||||
sfText_SetBlendMode
|
||||
sfText_GetX
|
||||
sfText_GetY
|
||||
sfText_GetScaleX
|
||||
sfText_GetScaleY
|
||||
sfText_GetRotation
|
||||
sfText_GetOriginX
|
||||
sfText_GetOriginY
|
||||
sfText_GetColor
|
||||
sfText_GetBlendMode
|
||||
sfText_Move
|
||||
sfText_Scale
|
||||
sfText_Rotate
|
||||
sfText_TransformToLocal
|
||||
sfText_TransformToGlobal
|
||||
sfText_SetString
|
||||
sfText_SetUnicodeString
|
||||
sfText_SetFont
|
||||
sfText_SetSize
|
||||
sfText_SetStyle
|
||||
sfText_GetUnicodeString
|
||||
sfText_GetString
|
||||
sfText_GetFont
|
||||
sfText_GetSize
|
||||
sfText_GetStyle
|
||||
sfText_GetCharacterPos
|
||||
sfText_GetRect
|
||||
sfRenderImage_Create
|
||||
sfRenderImage_Destroy
|
||||
sfRenderImage_GetWidth
|
||||
|
@ -177,10 +177,10 @@ EXPORTS
|
|||
sfRenderImage_Display
|
||||
sfRenderImage_DrawSprite
|
||||
sfRenderImage_DrawShape
|
||||
sfRenderImage_DrawString
|
||||
sfRenderImage_DrawText
|
||||
sfRenderImage_DrawSpriteWithShader
|
||||
sfRenderImage_DrawShapeWithShader
|
||||
sfRenderImage_DrawStringWithShader
|
||||
sfRenderImage_DrawTextWithShader
|
||||
sfRenderImage_Clear
|
||||
sfRenderImage_SetView
|
||||
sfRenderImage_GetView
|
||||
|
@ -215,10 +215,10 @@ EXPORTS
|
|||
sfRenderWindow_GetFrameTime
|
||||
sfRenderWindow_SetJoystickThreshold
|
||||
sfRenderWindow_DrawSprite
|
||||
sfRenderWindow_DrawString
|
||||
sfRenderWindow_DrawText
|
||||
sfRenderWindow_DrawShape
|
||||
sfRenderWindow_DrawSpriteWithShader
|
||||
sfRenderWindow_DrawStringWithShader
|
||||
sfRenderWindow_DrawTextWithShader
|
||||
sfRenderWindow_DrawShapeWithShader
|
||||
sfRenderWindow_Clear
|
||||
sfRenderWindow_SetView
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue