How dyou do that scrolling text effect?
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Lunarbeam

Grrr, I've been trying and trying but I just can't get scrolling text to work. You know, how the letters appear one after the other until the message is finished? Yeah, it's proving to be not only painful, but impossible.

The way my TextBox function works is this: you pass in one string of text and it cuts it up into lines based on the space available in the text box. It also cuts it up into separate calls if the amount of text is too large (ah, the wonders of recursion). Anyway, all the text is stored in part[1-8] (thats 1 through 8, btw).

The way I usually draw text looks like this:
for(i = 1;i



Posted on 2000-12-28 22:28:52

el_desconocido

Instead of a for loop, try something like this:

inc=0; ltimer=timer+15;
while(inc<strlen(phrase))
{
rectfill(0,0,screenx-1,screeny-1,black);
gotoxy(20,420);
printstring(big,left(phrase,inc+1));
updatecontrols();
showpage();
if(timerltimer) { inc++; ltimer=timer+7+random(8); }
}





-Pontifex
"How many rocks are there, in the whole world?"

Posted on 2000-12-29 19:15:41

el_desconocido

if(timer>ltimer) { inc++; ltimer=timer+7+random(8); }




-Pontifex
"How many rocks are there, in the whole world?"

Posted on 2000-12-29 19:18:08

andy

Just use setcliprect to clip the text for you!
This could be adapted to use a word-wrapper if you wanted, by the way.

string stext_line[3]; // I like arrays. ^_^

void SText(string s1,string s2,string s3)
{
int curline,curchar;
int x,y; // position that the box is displayed
int i,j; // loop counters

stext_line[0]=s1; stext_line[1]=s2; stext_line[2]=s3; // a little hacky, I know
x=0; y=0; // you could pass these as parameters, if you wanted

for (curline=0; curline<3; curline++)
{
for (curchar=0; curchar<strlen(stext_line[curline]); curchar++) // loop through every char in the string
{
Render();
DrawBox(x,y,x+screenx,y+(screeny/3)); // change this as necessary

for (i=0; i<curline; i++) // draw any lines that we've already written out
{
gotoxy(x,y+(fontheight(0)*i)); // go to wherever this line should be written
printstring(0,stext_line[i]);
}
gotoxy(x,y+(fontheight(0)*curline)); // draw this line (however much of it we must draw)
setcliprect(x,y,x+(fontwidth(0)*curchar),screeny); // we'll be cheap, since it's only writing one line anyway. ^_~
printstring(0,stext_line[curline]); // voila!

showpage();
updatecontrols();
delay(1);
}
}
}

This is all untested, by the way, so good luck!



'Never confuse a single defeat with a final defeat.' -F. Scott Fitzgerald

Posted on 2000-12-30 13:44:41

Lunarbeam

Thanks for all the help everyone -- my faith in the help board has been restored thanks to you! (and, on top of that, my text finally works! woohoo!)



Posted on 2000-12-30 14:26:24


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.