CSFML

- Main Page
- Data Structures
- Files

- File List
- Globals

Text.h
Go to the documentation of this file.
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24
25 #ifndef SFML_TEXT_H
26 #define SFML_TEXT_H
27
29 // Headers
31 #include <SFML/Graphics/Export.h>
32 #include <SFML/Graphics/Color.h>
33 #include <SFML/Graphics/Rect.h>
34 #include <SFML/Graphics/Types.h>
35 #include <SFML/Graphics/Transform.h>
36 #include <SFML/System/Vector2.h>
37 #include <stddef.h>
38
39
43 typedef enum
44 {
45 sfTextRegular = 0,
46 sfTextBold = 1 << 0,
47 sfTextItalic = 1 << 1,
48 sfTextUnderlined = 1 << 2
49 } sfTextStyle;
50
51
58 CSFML_GRAPHICS_API sfText* sfText_create(void);
59
68 CSFML_GRAPHICS_API sfText* sfText_copy(const sfText* text);
69
76 CSFML_GRAPHICS_API void sfText_destroy(sfText* text);
77
89 CSFML_GRAPHICS_API void sfText_setPosition(sfText* text, sfVector2f position);
90
102 CSFML_GRAPHICS_API void sfText_setRotation(sfText* text, float angle);
103
115 CSFML_GRAPHICS_API void sfText_setScale(sfText* text, sfVector2f scale);
116
131 CSFML_GRAPHICS_API void sfText_setOrigin(sfText* text, sfVector2f origin);
132
141 CSFML_GRAPHICS_API sfVector2f sfText_getPosition(const sfText* text);
142
153 CSFML_GRAPHICS_API float sfText_getRotation(const sfText* text);
154
163 CSFML_GRAPHICS_API sfVector2f sfText_getScale(const sfText* text);
164
173 CSFML_GRAPHICS_API sfVector2f sfText_getOrigin(const sfText* text);
174
185 CSFML_GRAPHICS_API void sfText_move(sfText* text, sfVector2f offset);
186
197 CSFML_GRAPHICS_API void sfText_rotate(sfText* text, float angle);
198
209 CSFML_GRAPHICS_API void sfText_scale(sfText* text, sfVector2f factors);
210
219 CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText* text);
220
229 CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText* text);
230
240 CSFML_GRAPHICS_API void sfText_setString(sfText* text, const char* string);
241
249 CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfUint32* string);
250
265 CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font);
266
276 CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
277
289 CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
290
300 CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color);
301
310 CSFML_GRAPHICS_API const char* sfText_getString(const sfText* text);
311
320 CSFML_GRAPHICS_API const sfUint32* sfText_getUnicodeString(const sfText* text);
321
334 CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text);
335
344 CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
345
354 CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
355
364 CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text);
365
382 CSFML_GRAPHICS_API sfVector2f sfText_findCharacterPos(const sfText* text, size_t index);
383
398 CSFML_GRAPHICS_API sfFloatRect sfText_getLocalBounds(const sfText* text);
399
414 CSFML_GRAPHICS_API sfFloatRect sfText_getGlobalBounds(const sfText* text);
415
416
417 #endif // SFML_TEXT_H
sfText_getInverseTransform
CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText *text)
Get the inverse of the combined transform of a text.
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition: Graphics/Export.h:43
sfText_setCharacterSize
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText *text, unsigned int size)
Set the character size of a text.
sfTextStyle
sfTextStyle
sfText styles
Definition: Text.h:43
sfText_setUnicodeString
CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText *text, const sfUint32 *string)
Set the string of a text (from a unicode string)
sfTextBold
Characters are bold.
Definition: Text.h:46
Export.h
sfText_create
CSFML_GRAPHICS_API sfText * sfText_create(void)
Create a new text.
sfText_move
CSFML_GRAPHICS_API void sfText_move(sfText *text, sfVector2f offset)
Move a text by a given offset.
sfText_getOrigin
CSFML_GRAPHICS_API sfVector2f sfText_getOrigin(const sfText *text)
Get the local origin of a text.
sfText_getRotation
CSFML_GRAPHICS_API float sfText_getRotation(const sfText *text)
Get the orientation of a text.
sfTextItalic
Characters are in italic.
Definition: Text.h:47
sfText_getLocalBounds
CSFML_GRAPHICS_API sfFloatRect sfText_getLocalBounds(const sfText *text)
Get the local bounding rectangle of a text.
Transform.h
sfText_getScale
CSFML_GRAPHICS_API sfVector2f sfText_getScale(const sfText *text)
Get the current scale of a text.
sfTextUnderlined
Characters are underlined.
Definition: Text.h:48
sfText_setPosition
CSFML_GRAPHICS_API void sfText_setPosition(sfText *text, sfVector2f position)
Set the position of a text.
sfText_getCharacterSize
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText *text)
Get the size of the characters of a text.
sfText_getUnicodeString
CSFML_GRAPHICS_API const sfUint32 * sfText_getUnicodeString(const sfText *text)
Get the string of a text (returns a unicode string)
sfFloatRect
sfFloatRect and sfIntRect are utility classes for manipulating rectangles.
Definition: Rect.h:38
sfColor
Utility class for manpulating RGBA colors.
Definition: Color.h:38
Vector2.h
sfText_scale
CSFML_GRAPHICS_API void sfText_scale(sfText *text, sfVector2f factors)
Scale a text.
sfText_setColor
CSFML_GRAPHICS_API void sfText_setColor(sfText *text, sfColor color)
Set the global color of a text.
sfText_getTransform
CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText *text)
Get the combined transform of a text.
sfText_setString
CSFML_GRAPHICS_API void sfText_setString(sfText *text, const char *string)
Set the string of a text (from an ANSI string)
sfFont
struct sfFont sfFont
Definition: Graphics/Types.h:31
sfText_getString
CSFML_GRAPHICS_API const char * sfText_getString(const sfText *text)
Get the string of a text (returns an ANSI string)
sfUint32
unsigned int sfUint32
Definition: Config.h:129
sfText_setRotation
CSFML_GRAPHICS_API void sfText_setRotation(sfText *text, float angle)
Set the orientation of a text.
sfText
struct sfText sfText
Definition: Graphics/Types.h:39
sfText_getColor
CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText *text)
Get the global color of a text.
sfText_destroy
CSFML_GRAPHICS_API void sfText_destroy(sfText *text)
Destroy an existing text.
sfText_rotate
CSFML_GRAPHICS_API void sfText_rotate(sfText *text, float angle)
Rotate a text.
Types.h
Color.h
sfText_getStyle
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText *text)
Get the style of a text.
sfText_findCharacterPos
CSFML_GRAPHICS_API sfVector2f sfText_findCharacterPos(const sfText *text, size_t index)
Return the position of the index-th character in a text.
sfText_setOrigin
CSFML_GRAPHICS_API void sfText_setOrigin(sfText *text, sfVector2f origin)
Set the local origin of a text.
sfTransform
Encapsulate a 3x3 transform matrix.
Definition: Transform.h:42
sfVector2f
2-component vector of floats
Definition: Vector2.h:60
sfText_getGlobalBounds
CSFML_GRAPHICS_API sfFloatRect sfText_getGlobalBounds(const sfText *text)
Get the global bounding rectangle of a text.
Rect.h
sfText_setStyle
CSFML_GRAPHICS_API void sfText_setStyle(sfText *text, sfUint32 style)
Set the style of a text.
sfText_getPosition
CSFML_GRAPHICS_API sfVector2f sfText_getPosition(const sfText *text)
Get the position of a text.
sfText_copy
CSFML_GRAPHICS_API sfText * sfText_copy(const sfText *text)
Copy an existing text.
sfText_setScale
CSFML_GRAPHICS_API void sfText_setScale(sfText *text, sfVector2f scale)
Set the scale factors of a text.
sfTextRegular
Regular characters, no style.
Definition: Text.h:45
sfText_getFont
CSFML_GRAPHICS_API const sfFont * sfText_getFont(const sfText *text)
Get the font used by a text.
sfText_setFont
CSFML_GRAPHICS_API void sfText_setFont(sfText *text, const sfFont *font)
Set the font of a text.