#include <stdarg.h>
#include <SDL_types.h>
#include <wchar.h>
#include <libintl.h>
#include "bool.h"
Include dependency graph for text.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | _(text) ((wchar_t*)gettext((char*)(text))) |
A macro to make using gettext() shorter by giving it a shorter name and performing the needed type casts to avoid compiler warnings. | |
#define | prnfile fwprintf |
Writes a formatted string to a file using fwprintf(), fprintf(), or a similar function. | |
#define | prnout wprintf |
Writes a formatted string to stdout using wprintf(), printf(), or a similar function. | |
#define | prnstr swprintf |
Writes a formatted string to another string using snwprintf(), snprintf(), or a similar function. | |
#define | RenderTTF TTF_RenderUNICODE_Blended |
The function to render text. | |
#define | rtsa_strchr wcschr |
Finds the next instance of a specific character in a string using either wstrchr() for I18N support, or strchr. | |
#define | rtsa_strcmp wcscmp |
A string compare function, either wcscmp() for I18N support, or strcmp(). | |
#define | rtsa_strcpy wcscpy |
A string copy function, either wcscpy() for I18N support, or strcpy(). | |
#define | rtsa_strlen wcslen |
A string length function, either wcslen() for I18N support, or strlen(). | |
#define | rtsa_strncpy wcsncpy |
A string copy function, either wcsncpy() for I18N support, or strncpy(). | |
#define | SizeTTF TTF_SizeUNICODE |
The function to report the height and width of text. | |
#define | vprnstr vswprintf |
Writes a formatted string to another string using vsnwprintf(), vsnprintf(), or a similar function. | |
#define | witechar putwc |
Writes a single character to a file using putwc(), or putc(). | |
Typedefs | |
typedef wchar_t | rtsa_char |
The character type used to store and manipulate strings for later output. | |
typedef Uint16 | rtsa_outchar |
The character type used in the strings given to the SDL_ttf functions. | |
Enumerations | |
enum | { TEXTITEM_TITLE, TEXTITEM_TRANS, TEXTITEM_AUTH, TEXTITEM_COPYRIGHT, TEXTITEM_GPL, TEXTITEM_ERROR = 1, TEXTITEM_ERRCONT, TEXTITEM_CHOSETEAM = 1, TEXTITEM_FIREOPT, TEXTITEM_NETSTAT, TEXTITEM_NETOPTS, TEXTITEM_REDMEM, TEXTITEM_BLUEMEM, TEXTITEM_REDTEAM = 0, TEXTITEM_BLUETEAM, TEXTITEM_REDSCORE, TEXTITEM_BLUESCORE, TEXTITEM_RESPAWN, TEXTITEM_MISC, TEXTITEM_MAX } |
Indices into an array of RenderItems used to render text. More... | |
enum | { STRING_REDTEAM, STRING_BLUETEAM, STRING_REDFLAGHELD, STRING_REDFLAGCAP, STRING_BLUEFLAGHELD, STRING_BLUEFLAGCAP, STRING_TEAMKILL, STRING_LOCALTEAMKILLER, STRING_LOCALTEAMKILLED, STRING_KILL, STRING_LOCALKILL, STRING_REDWIN, STRING_BLUEWIN, STRING_RESPAWN, STRING_TITLE, STRING_AUTH, STRING_TRANS, STRING_COPYRIGHT, STRING_GPL, STRING_CHOSETEAM, STRING_FIREOPT, STRING_FIRECONT, STRING_NETLOOKING, STRING_NETCONTACT, STRING_NETRCVCFG, STRING_NETCLIENT, STRING_NETCLIDISCONN, STRING_NETSERVER, STRING_NETSRVDISCONN, STRING_NETDENY, STRING_NETDISCONN, STRING_NETSEARCHERR, STRING_NETSRVERR, STRING_NETCONERR, STRING_NETADDR, STRING_NETSYNC, STRING_NETLAT, STRING_DEFAULTNAME, STRING_TIMEFORM, STRING_TIMELEFT, STRING_BF_STAT, STRING_CMPLOPT, STRING_ERR_READ, STRING_ERR_PROC, STRING_ERR_MEM, STRING_ERR_FOPEN, STRING_ERR_EOFINC, STRING_ERR_EOFNAME, STRING_ERR_NAMELONG, STRING_ERR_FLDSMALL, STRING_ERR_FLDLARGE, STRING_ERR_NOSIZE, STRING_ERR_INVLDKEY, STRING_ERR_NOREDSPN, STRING_ERR_NOBLSPN, STRING_ERR_NOREDGOAL, STRING_ERR_NOBLGOAL, STRING_ERR_BACKSLASH, STRING_ERR_IO, STRING_ERR_EOL, STRING_ERR_PARAM, STRING_ERR_XYRANGE, STRING_ERR_WHRANGE, STRING_ERR_BADOWN, STRING_ERR_NONE, STRING_ERR_WOULDBLOCK, STRING_ERR_BADF, STRING_ERR_FAULT, STRING_ERR_INTR, STRING_ERR_INVAL, STRING_ERR_NOTSOCK, STRING_ERR_ADDRINUSE, STRING_ERR_NETDOWN, STRING_ERR_NETUNREACH, STRING_ERR_CONNRESET, STRING_ERR_CONNREFUSED, STRING_ERR_HOSTUNREACH, STRING_ERR_HOSTLOOK, STRING_ERR_SDL, STRING_ERR_VIDQ, STRING_ERR_VIDMODE, STRING_ERR_TTFINIT, STRING_ERR_RENDER, STRING_ERR_FNTOPEN, STRING_ERR_FNTINIT, STRING_ERR_OPENAUDIO, STRING_ERR_LOADSND, STRING_ERR_NOSNDS, STRING_ERR_DEFAULT, STRING_STAT_SINGLEBUFF, STRING_STAT_DOUBLEBUFF, STRING_STAT_NOHWACCEL, STRING_STAT_HWACCEL, STRING_STAT_OUTSYSMEM, STRING_STAT_OUTGRPMEM, STRING_STAT_VIDDRNAME, STRING_STAT_JOYSTICK, STRING_STAT_NOAUDIO, STRING_STAT_ENTERSTATE, STRING_STAT_EXITSTATE, STRING_MAX } |
Indices into an array of constant strings used for messages presented to the user. More... | |
enum | FONTS { FONT_MESSAGE, FONT_SCORE, FONT_PLAYER, FONT_MAX } |
The available fonts. More... | |
Functions | |
Bool | FontInit () |
Initalizes fonts and other graphical parts of the text system. | |
Bool | TextInit () |
Initalizes the text system's string table and support for translation through GNU gettext (if compiled to support gettext). | |
int | TextNativeToUTF16 (Uint16 *dest, size_t destlen, rtsa_char *src, size_t srclen) |
Converts a string from the internal format to big endian UTF-16. | |
Bool | TextRenderString (RenderItem *text, int font, int maxwidth, SDL_Color color, const rtsa_char *format,...) |
Renders a string to an SDL_Surface stored at text->data, sets the size to match, and sets the render function to GenericSurfaceRenderer(). | |
Bool | TextRenderStringV (RenderItem *text, int font, int maxwidth, SDL_Color color, const rtsa_char *format, va_list args) |
Renders a string to an SDL_Surface stored at text->data, sets the size to match, and sets the render function to GenericSurfaceRenderer(). | |
Bool | TextSetupStateMenu () |
Configures the text system for use with STATE_CODES::STATE_MENUROOT and other menu states. | |
Bool | TextSetupStatePlay () |
Configures the text system for use with STATE_CODES::STATE_PLAY. | |
Bool | TextSetupStateSplash () |
Configures the text system for use with STATE_CODES::STATE_SPLASH. | |
void | TextSetWindowTitle () |
Sets the title used on the program's window. | |
void | TextUninit () |
Uninitalizes the text system and loaded fonts. | |
void | TextUnsetState () |
Removes rendered text items in preperation for a new set to be rendered. | |
int | TextUTF16toNative (rtsa_char *dest, size_t destlen, Uint16 *src, size_t srclen) |
Converts a string from big endian UTF-16 to the internal format. | |
Variables | |
rtsa_char * | strings [STRING_MAX] |
An array of strings with message text. | |
RenderItem | textItems [TEXTITEM_MAX] |
The array of text items that can be displayed. |
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/
Definition in file text.h.