示例#1
0
/**
**  Make font bitmap.
*/
void CFont::MakeFontColorTextures() const
{
	if (!FontColorGraphics[this].empty()) {
		// already loaded
		return;
	}
	const CGraphic &g = *this->G;
	SDL_Surface *s = g.Surface;

	for (FontColorMap::iterator it = FontColors.begin(); it != FontColors.end(); ++it) {
		CFontColor *fc = it->second;
		CGraphic *newg = FontColorGraphics[this][fc] = new CGraphic;

		newg->Width = g.Width;
		newg->Height = g.Height;
		newg->NumFrames = g.NumFrames;
		newg->GraphicWidth = g.GraphicWidth;
		newg->GraphicHeight = g.GraphicHeight;
		newg->Surface = g.Surface;

		SDL_LockSurface(s);
		for (int j = 0; j < MaxFontColors; ++j) {
			s->format->palette->colors[j] = fc->Colors[j];
		}
		SDL_UnlockSurface(s);
		MakeTexture(newg);
	}
}
示例#2
0
/**
**  Clean up the font module.
*/
void CleanFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont *font = it->second;

		font->Clean();
		delete font;
	}
	if (UseOpenGL) {
		FontColorGraphics.clear();
	}
	Fonts.clear();

	for (FontColorMap::iterator it = FontColors.begin(); it != FontColors.end(); ++it) {
		delete it->second;
	}
	FontColors.clear();

	SmallFont = NULL;
	GameFont = NULL;
}
示例#3
0
/**
**  Clean up the font module.
*/
void CleanFonts()
{
	for (FontMap::iterator it = Fonts.begin(); it != Fonts.end(); ++it) {
		CFont *font = it->second;

		font->Clean();
		delete font;
	}
#if defined(USE_OPENGL) || defined(USE_GLES)
	if (UseOpenGL) {
		FontColorGraphics.clear();
	}
#endif
	Fonts.clear();

	for (FontColorMap::iterator it = FontColors.begin(); it != FontColors.end(); ++it) {
		delete it->second;
	}
	FontColors.clear();

	SmallFont = nullptr;
	GameFont = nullptr;
}