Want Text to appear gradually from Left to Right

In most RPGs, text appears gradually in the textbox from left to right for more fluid reading, but I only know how to output a text fully all at once.

Here is an example of what I mean (FF7): http://www.youtube.com/watch?v=k18Jc-O2NT4

How can I display text this way in my game? Thank you.


Note that I managed to make the following work in Console Application, but it does not work on a timer (I don't know how to do that), and it does not work in Win32 Application, so it is useless:

------------------------------------------------------------------
#include <iostream>
#include <string>
using namespace std;
int main(){
string charLine("This is what I say");
string toDisplay(charLine.length(),0);
int counter = 0;
while(charLine.compare(toDisplay)){
toDisplay[counter] = charLine[counter];
cout << toDisplay;
cin.get();
counter++;
}
}
---------------------------------------------------------------


Note that because this is for a game, we will be using Win32 Application (NOT console Application). I'm using Microsoft Visual Studio C++ 2010 linked to alleg.lib (Allegro 4.2.3). Allegro prints to the screen like so:

textprintf_ex(Buffer , font , (x-coordinate) , (y-coordinate) , makecol(255,255,255) , -1 , "%s" , Stringname.c_str())

Thanks again!




Last edited on
Topic archived. No new replies allowed.