|
Atrinik Client 2.5
|
#include <global.h>Go to the source code of this file.
Functions | |
| void | text_init () |
| void | text_deinit () |
| void | text_offset_set (int x, int y) |
| void | text_offset_reset () |
| void | text_color_set (int r, int g, int b) |
| void | text_set_selection (sint64 *start, sint64 *end, uint8 *started) |
| const char * | get_font_filename (int font) |
| int | get_font_id (const char *name, size_t size) |
| static void | reset_color (SDL_Surface *surface, SDL_Color *color, SDL_Color *orig_color) |
| char * | text_strip_markup (char *buf, size_t *buf_len, uint8 do_free) |
| static void | text_adjust_coords (SDL_Surface *surface, int *mx, int *my) |
| int | text_color_parse (const char *color_notation, SDL_Color *color) |
| int | blt_character (int *font, int orig_font, SDL_Surface *surface, SDL_Rect *dest, const char *cp, SDL_Color *color, SDL_Color *orig_color, uint64 flags, SDL_Rect *box, int *x_adjust) |
| int | glyph_get_width (int font, char c) |
| int | glyph_get_height (int font, char c) |
| void | string_blt (SDL_Surface *surface, int font, const char *text, int x, int y, const char *color_notation, uint64 flags, SDL_Rect *box) |
| void | string_blt_shadow (SDL_Surface *surface, int font, const char *text, int x, int y, const char *color_notation, const char *color_shadow_notation, uint64 flags, SDL_Rect *box) |
| void | string_blt_format (SDL_Surface *surface, int font, int x, int y, const char *color_notation, uint64 flags, SDL_Rect *box, const char *text,...) |
| void | string_blt_shadow_format (SDL_Surface *surface, int font, int x, int y, const char *color_notation, const char *color_shadow_notation, uint64 flags, SDL_Rect *box, const char *text,...) |
| int | string_get_width (int font, const char *text, uint64 flags) |
| int | string_get_height (int font, const char *text, uint64 flags) |
| void | string_truncate_overflow (int font, char *text, int max_width) |
| void | text_enable_debug () |
Variables | |
| static uint8 | text_debug = 0 |
| static uint8 | text_anchor_help_clicked = 0 |
| static char | text_anchor_help [HUGE_BUF] |
| static int | text_offset_mx = -1 |
| static int | text_offset_my = -1 |
| static sint64 * | selection_start = NULL |
| static sint64 * | selection_end = NULL |
| static uint8 * | selection_started = NULL |
| SDL_Color | text_link_color_default = {96, 160, 255, 0} |
| SDL_Color | text_link_color = {0, 0, 0, 0} |
| font_struct | fonts [FONTS_MAX] |
Text drawing API. Used SDL_ttf for rendering.
Definition in file text.c.
| int blt_character | ( | int * | font, |
| int | orig_font, | ||
| SDL_Surface * | surface, | ||
| SDL_Rect * | dest, | ||
| const char * | cp, | ||
| SDL_Color * | color, | ||
| SDL_Color * | orig_color, | ||
| uint64 | flags, | ||
| SDL_Rect * | box, | ||
| int * | x_adjust | ||
| ) |
Draw one character on the screen or parse markup (if applicable).
| [out] | font | Font to use. One of FONT_xxx. |
| orig_font | Original font, used for the font tag. | |
| surface | Surface to draw on. If NULL, there is no drawing done, but the return value is still calculated along with dest->w. | |
| dest | Destination, will have width (and x, if surface wasn't NULL) updated. | |
| cp | String we are working on, cp[0] is the character to draw. | |
| color | Color to use. | |
| orig_color | Original color. | |
| flags | Flags as passed to string_blt(). |
| const char* get_font_filename | ( | int | font | ) |
| int get_font_id | ( | const char * | name, |
| size_t | size | ||
| ) |
| int glyph_get_height | ( | int | font, |
| char | c | ||
| ) |
| int glyph_get_width | ( | int | font, |
| char | c | ||
| ) |
| static void reset_color | ( | SDL_Surface * | surface, |
| SDL_Color * | color, | ||
| SDL_Color * | orig_color | ||
| ) | [static] |
| void string_blt | ( | SDL_Surface * | surface, |
| int | font, | ||
| const char * | text, | ||
| int | x, | ||
| int | y, | ||
| const char * | color_notation, | ||
| uint64 | flags, | ||
| SDL_Rect * | box | ||
| ) |
Draw a string on the specified surface.
| surface | Surface to draw on. |
| font | Font to use. One of FONT_xxx. |
| text | The string to draw. |
| x | X position. |
| y | Y position. |
| color_notation | Color to use. |
| flags | One or a combination of Text flags. |
| box | If word wrap was enabled by passing TEXT_WORD_WRAP as one of the 'flags', this is used to get the max width from. Also even if word wrap is disabled, this is used to get the max height from, if set (both box->w and box->h can be 0 to indicate unlimited). |
| void string_blt_format | ( | SDL_Surface * | surface, |
| int | font, | ||
| int | x, | ||
| int | y, | ||
| const char * | color_notation, | ||
| uint64 | flags, | ||
| SDL_Rect * | box, | ||
| const char * | text, | ||
| ... | |||
| ) |
Like string_blt(), but allows using printf-like format specifiers.
Draw a string on the specified surface.
| surface | Surface to draw on. |
| font | Font to use. One of FONT_xxx. |
| text | The string to draw. |
| x | X position. |
| y | Y position. |
| color_notation | Color to use. |
| flags | One or a combination of Text flags. |
| box | If word wrap was enabled by passing TEXT_WORD_WRAP as one of the 'flags', this is used to get the max width from. Also even if word wrap is disabled, this is used to get the max height from, if set (both box->w and box->h can be 0 to indicate unlimited). |
| void string_blt_shadow | ( | SDL_Surface * | surface, |
| int | font, | ||
| const char * | text, | ||
| int | x, | ||
| int | y, | ||
| const char * | color_notation, | ||
| const char * | color_shadow_notation, | ||
| uint64 | flags, | ||
| SDL_Rect * | box | ||
| ) |
Draw a string with a shadow.
| surface | Surface to draw on. |
| font | Font to use. One of FONT_xxx. |
| text | The string to draw. |
| x | X position. |
| y | Y position. |
| color_notation | Color to use. |
| color_shadow_notation | Color to use for the shadow. |
| flags | One or a combination of Text flags. |
| box | If word wrap was enabled by passing TEXT_WORD_WRAP as one of the 'flags', this is used to get the max width from. Also even if word wrap is disabled, this is used to get the max height from, if set (both box->w and box->h can be 0 to indicate unlimited). |
| void string_blt_shadow_format | ( | SDL_Surface * | surface, |
| int | font, | ||
| int | x, | ||
| int | y, | ||
| const char * | color_notation, | ||
| const char * | color_shadow_notation, | ||
| uint64 | flags, | ||
| SDL_Rect * | box, | ||
| const char * | text, | ||
| ... | |||
| ) |
Like string_blt_shadow(), but allows using printf-like format specifiers.
Draw a string with a shadow.
| surface | Surface to draw on. |
| font | Font to use. One of FONT_xxx. |
| text | The string to draw. |
| x | X position. |
| y | Y position. |
| color_notation | Color to use. |
| color_shadow_notation | Color to use for the shadow. |
| flags | One or a combination of Text flags. |
| box | If word wrap was enabled by passing TEXT_WORD_WRAP as one of the 'flags', this is used to get the max width from. Also even if word wrap is disabled, this is used to get the max height from, if set (both box->w and box->h can be 0 to indicate unlimited). |
| int string_get_height | ( | int | font, |
| const char * | text, | ||
| uint64 | flags | ||
| ) |
Calculate string's pixel height, taking into account markup, if applicable.
It is usually enough to use FONT_HEIGHT() to get the string's font height, unless markup is allowed, in which case the maximum used height might be different.
| font | Font. One of FONT_xxx. |
| text | String to get height of. |
| flags | One or a combination of Text flags. |
| int string_get_width | ( | int | font, |
| const char * | text, | ||
| uint64 | flags | ||
| ) |
Calculate string's pixel width, taking into account markup, if applicable.
| font | Font. One of FONT_xxx. |
| text | String to get width of. |
| flags | One or a combination of Text flags. |
| void string_truncate_overflow | ( | int | font, |
| char * | text, | ||
| int | max_width | ||
| ) |
| static void text_adjust_coords | ( | SDL_Surface * | surface, |
| int * | mx, | ||
| int * | my | ||
| ) | [static] |
| int text_color_parse | ( | const char * | color_notation, |
| SDL_Color * | color | ||
| ) |
| void text_color_set | ( | int | r, |
| int | g, | ||
| int | b | ||
| ) |
| void text_init | ( | ) |
| void text_offset_reset | ( | ) |
Reset the text offset. This must be done after text_offset_set() and string_blt() calls eventually,
| void text_offset_set | ( | int | x, |
| int | y | ||
| ) |
If string_blt() is called on surface that is not ScreenSurface, you must use this to set mouse X/Y detection offset, so things like links will work correctly.
Note that this is not required for widget surfaces, as it's done automatically by searching the widgets for the surface that is being used.
| x | X position of the surface. |
| y | Y position of the surface. |
| void text_set_selection | ( | sint64 * | start, |
| sint64 * | end, | ||
| uint8 * | started | ||
| ) |
Allow grabbing a text selection.
| start | Pointer that will be used to store start of selection. |
| end | Pointer that will be used to store start of selection. |
| started | Pointer that is used to determine whether to store selection data in start or end. |
| char* text_strip_markup | ( | char * | buf, |
| size_t * | buf_len, | ||
| uint8 | do_free | ||
| ) |
Remove all markup tags, including their contents.
Entities will also be replaced with their proper replacements.
| buf | Buffer containing the text with markup, from which to remove tags. | |
| [out] | len | Length of 'buf'. This will contain the length of the new string, without markup tags. Can be NULL, in which case length of the original string will be calculated automatically. |
| do_free | If 1, will automatically free 'buf'. |
| font_struct fonts[FONTS_MAX] |
sint64* selection_end = NULL [static] |
sint64* selection_start = NULL [static] |
uint8* selection_started = NULL [static] |
char text_anchor_help[HUGE_BUF] [static] |
Help GUI to open if text_anchor_help_clicked is 1.
uint8 text_anchor_help_clicked = 0 [static] |
If not 0, text_anchor_help is used to open the help GUI after finishing drawing.
This is used so the text being drawn is not changed in the middle of the drawing by clicking on a link.
uint8 text_debug = 0 [static] |
If 1, all text shown using 'box' parameter of string_blt() for max width/height will have a frame around it.
| SDL_Color text_link_color = {0, 0, 0, 0} |
| SDL_Color text_link_color_default = {96, 160, 255, 0} |
int text_offset_mx = -1 [static] |
int text_offset_my = -1 [static] |
1.7.4