Main Menu

Sponsored Links


Web Cartoon Maker: a Fun Way to Learn C++ Contents Previous Next

Outputting Variables

You can output the value of a string variable using the same commands we used to output string values by using a text object in our cartoon:

void Scene1 ()


string sHello = "Hello" ;

Text HelloText ( sText );

HelloText.SetVisible ( true );


We just need to use a variable name instead of a string value.

In classic C++ you would not be able to use other kinds of values and variables to create a similar text object, because a text object requires a string value as a parameter. But as I said before, values of other types (int, char and double) can be converted to strings automatically in WCM C++. This means that you can use these values and variables to create a text object or change the text:

void Scene1 ()


Text MyText ( "Hello" ); // create a text object from string value

MyText.SetVisible ( true );

SetTime ( 1.0 );

MyText.SetText ( 5 ); // change the text using int value

SetTime ( 2.0 );

MyText.SetText ( 5.72 ); // change the text using double value

SetTime ( 3.0 );

MyText.SetText ( 'a' ); // change the text using char value

string sVal = "Hello";

int iVal = 5;

double dVal = 5.72;

char cVal = 'a';

SetTime ( 4.0 );

MyText.SetText ( sVal ); // change the text using string variable

SetTime ( 5.0 );

MyText.SetText ( iVal ); // change the text using int variable

SetTime ( 6.0 );

MyText.SetText ( dVal ); // change the text using double variable

SetTime ( 7.0 );

MyText.SetText ( cVal ); // change the text using char variable

// wait one more second before the end of cartoon

SetTime ( 8.0 );


As you can see from this example , you can create all the objects before using any of them and use only when you need them.

You can try to compile and preview the above program. You will see an 8 seconds long cartoon showing you the following text strings two times (one using values and one using variables):

Contents Previous Next

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi


Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat


Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.


Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal


read more news...