text.c File Reference

Implementaion of on-screen text handling and constant strings. More...

#include "color.h"
#include "render.h"
#include "text.h"
#include "genconmac.h"
#include "states.h"
#include <SDL_ttf.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <errno.h>
#include <wchar.h>
#include <iconv.h>

Include dependency graph for text.c:

Go to the source code of this file.

Defines

#define TEXT_MAX_LINES   16
 The maximum number of lines that TextRenderString() can break a string into.

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().
static Bool TextSetup (int startStr, int startInd, int endInd, int font, SDL_Color color)
 Renders several of the constant strings and puts them in a ready to use RenderItem in textItems.
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

char binPath [128]
 Stores the path to where the binary is located.
static int fontHeight [FONT_MAX]
 The height of each font.
static TTF_Font * fonts [FONT_MAX]
 Pointers to the loaded and ready-to-use fonts.
static int spaceWidth [FONT_MAX]
 The width of a space in each font.
static iconv_t strconvdescr
 A descriptor used to convert text from the internal wide format (wchar_t) to native byte order UTF-16 for use with the SDL_ttf functions.
static iconv_t strconvntou
 A descriptor used to convert text from the internal wide format (wchar_t) to big endian UTF-16 for use with network communications.
static iconv_t strconvuton
 A descriptor used to convert text from big endian UTF-16 to the internal wide format (wchar_t) for network communications.
rtsa_charstrings [STRING_MAX]
 An array of strings with message text.
RenderItem textItems [TEXTITEM_MAX]
 The array of text items that can be displayed.


Detailed Description

Implementaion of on-screen text handling and constant strings.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

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.c.


Define Documentation

#define TEXT_MAX_LINES   16

The maximum number of lines that TextRenderString() can break a string into.

Definition at line 70 of file text.c.

Referenced by TextRenderStringV().


Variable Documentation

char binPath[128]

Stores the path to where the binary is located.

The data files for the program should also be here.

Definition at line 69 of file main.c.

Referenced by FontInit(), and main().


Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2