Codea – Terminal Text Class

I finally got a chance to release another class library I have been working on for awhile.  This one displays text one character at a time, much like a terminal or typewriter.

Download: Dropbox Link

How to Use

Example

txt=”This is just some example string to be displayed.”
txtColor = vec3(0,0,255)
fnt=”AmericanTypewriter-Bold”
fntSize = 20
delay = 5
pos=vec2(WIDTH/2,HEIGHT/2-30)
mode=CENTER
align=LEFT
exampleInstance = TerminalText(txt,txtColor,fnt,fntSize,delay,pos,mode,align)

txt: (String) – This is the Text to be displayed.
txtColor: (vec3) – Color the text to to be displayed in. Expressed in Normal (r,g,b) format.
fnt: (String) – This is the font to be used. You can find the value you want by first using font().
fntSize: (Int) –  Size the text to to be displayed.
delay: (Int) – Delay Setting for How Quickly Text Displays.  The larger the integer, the slower it types.
pos: (vec2) – Starting Position of the Text. Depending on Mode/Align, may be Center or the Lower left corner.
mode: (CENTER/CORNER) – Where the text will display in respect to the origin.  CORNER is used if you wish to align left or right.
align: (LEFT, CENTER, RIGHT) – Text alignment if mode is set to CORNER.

exampleInstance = TerminalText(txt,txtColor,fnt,fntSize,delay,pos,mode,align) : Creates the text Instance.

To begin displaying this instance, simply call exampleInstance:draw() until the string is completely displayed.

Once the string is done, the class variable exampleInstance.completed is set to true. You can use this class variable to detect when a specific Terminal Text instance has finished displaying.

 

Hope this is useful to you!

Leave a Reply