All pastes #619230 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-14 15:41 UTC
rendered paste body
void MWgtSpeech::draw()
{
	int currX = x;
	int currY = y;
	int c = startChar;

	int bg = ((MWgtFrame*)parent)->getColor();

	while (c < currChar) {
		if (text[c] == ' ') {
			char word[100];
			int i;
			for (i = c+1; text[i] != ' ' && text[i] != SPEECH_STOP_CHAR && text[i]; i++)
				word[i-c-1] = text[i];
			word[i-c-1] = 0;
			if ((currX + text_length(mFont, "  ") +
					text_length(mFont, word)) > (x+width)) {
				currX = x;
				currY += text_height(mFont)+3;
			}
			else {
				currX += text_length(mFont, "  ");
			}
		}
		else {
			char s[2];
			s[0] = text[c];
			s[1] = 0;
			mPrintf(tguiBitmap, currX, currY, makecol(255, 255, 255),
				bg, false, true, s);
			currX += text_length(mFont, s);
		}
		c++;
	}
}