ページ 11

文字の色

Posted: 2009年11月22日(日) 09:17
by uu
例えば スコア300という文字列があったとします。
スコアを白、300を赤としたいです。この場合私は二つのDrawFormatString関数を
使って設定していますが、ひとつの関数でまとめることは可能でしょうか?
よろしくお願いします。

Re:文字の色

Posted: 2009年11月22日(日) 12:29
by kazuoni
例えば、それを関数化して、
int MyDrawFormatString(int x, int y, const char *str, int score, int color1, int color2 )
{
	const int distance = 16;
	DrawFormatString(x, y, color1, "%s ",str);
	DrawFormatString(x+GetDrawStringWidth(str, 0xff)+distance, y, color2, "%d\n",score); 
	return 0;
}
なんて書けます。