All pastes #619236 Raw Edit

Something

public text v1 · immutable
·published 2007-07-14 15:46 UTC
rendered paste body
void mPrintf(BITMAP* bmp, int x, int y, int fore, int back, bool center,
		bool shadow, const char* fmt, ...)
{
	va_list ap;
	char text[1000];

	va_start(ap, fmt);
	vsnprintf(text, (sizeof(text)/sizeof(*text))-1, fmt, ap);

	if (shadow) {
		set_font_color(getr(back), getg(back), getb(back),
				0, 0, 0);

		if (center) {
			textprintf_centre_ex(bmp, mFont, x, y-1, -1, -1, text);
			textprintf_centre_ex(bmp, mFont, x-1, y, -1, -1, text);
			textprintf_centre_ex(bmp, mFont, x+1, y, -1, -1, text);
			textprintf_centre_ex(bmp, mFont, x, y+1, -1, -1, text);
		}
		else {
			textprintf_ex(bmp, mFont, x, y-1, -1, -1, text);
			textprintf_ex(bmp, mFont, x-1, y, -1, -1, text);
			textprintf_ex(bmp, mFont, x+1, y, -1, -1, text);
			textprintf_ex(bmp, mFont, x, y+1, -1, -1, text);
		}

		set_font_color(getr(0), getg(0), getb(0),
				getr(fore), getg(fore), getb(fore));

		if (center)
			textprintf_centre_ex(bmp, mFont, x, y, -1, -1, text);
		else
			textprintf_ex(bmp, mFont, x, y, -1, -1, text);
	}
	else {
		set_font_color(getr(back), getg(back), getb(back),
				getr(fore), getg(fore), getb(fore));

		if (center)
			textprintf_centre_ex(bmp, mFont, x, y, -1, -1, text);
		else
			textprintf_ex(bmp, mFont, x, y, -1, -1, text);
	}
}