Advertisement

Trying to get a zelda style textbox going

Started by April 18, 2014 01:56 AM
9 comments, last by ISDCaptain01 10 years, 9 months ago

Thank you Lactose, I got it to work, but its rather slow here is the code, it works like I want it to:


//Scrolling text box function
void DrawScrollText(char text[], int &x, int y)
{
	oldTime = timeElapsed;
	timeElapsed = al_get_time() - tickCounter;
	storage[0] = text[timeElapsed];
	

	if(timeElapsed < strlen(text))
	{
		if(timeElapsed != oldTime)
			al_play_sample_instance(beepInstance);
	}
	else
	{
		timeElapsed = strlen(text);
		return;
	}
}

void CharsToPrint(int numCharsToPrint, char text[], int x, int y)
{
	for(int i = 0; i < numCharsToPrint; i++)
	{
		s[0] = text[i];
		al_draw_text(font, al_map_rgb(255, 255, 255), x, y, NULL, s);
		x += al_get_text_width(font, s);
	}	
}

This topic is closed to new replies.

Advertisement