On screen text display high level method proposal
Status: Alpha
Brought to you by:
cwalther
From: Andrea V. <and...@gm...> - 2008-07-31 09:13:31
|
Hi Christian, I perfected my system to show the texts in Pipmak. I have tryed to write a simple function but in the same time powerfull: There are only one new method: pipmak.displaytext("text") the default behaviour show the text centered at the bottom of the screen and it could be multiline using "line1\nline2\nline3", without args the text remain showed until you clear it with pipmak.displaytext() or you substitute with another text. A border is drawed around the text with a contrasting color to avoid situation like write white on white.... I have prefered name pipmak.displaytext() respect pipmak.message() because last case could generate confusion with message passing, but you can found another more suitable name. If you add the delay parameter, the text will be deleted after the delay time: pipmak.displaytext{"message",delay=3} The "message" will be deleted after 3 sec. if you submit another text during the delay, the text doesn't substitute last message, but it will be cached and showed after the deletion of the first message: pipmak.displaytext{"message1",delay=3} pipmak.displaytext{"message2",delay=3} pipmak.displaytext{"message3"} This permits also a lot of animation effects (see the demo) other paramaters permit to modify size,font,color,position,alignment: x=... y=... font="font.ttf" size=24 color={r,g,b,a} border={r,g,b,a} alignment=pipmak.left|pipmak.center|pipmak.right There also another parameter: style style can store all of above parameters, to reuse they, without the need to rewrite (for example if I want to always use the same style in all my messages) it works like CSS, so I can redefine some parameters: mystyle={font="arial.ttf",size=24,x=50,alignment=pipmak.right,delay=3} pipmak.displaytext{"My message",style=mystyle,size=28} In this case I have redefined the size of the defined style Last parameter is scroll. scroll can be one of {"char","word","line"} delay in this case is the duration of a single scrolling step, the text will be showed char by char, or word by word, or line by line. if you don't define a delay, the scroll will proceed at the maximum speed permited by the system. I have prepare a demo here: http://andrea.viarengo.googlepages.com/displaytext.pipmak There are only the definition of the function to place in defaults.lua (now I placed in main.lua) and the internal node -21 (but you can choice another number...) What you thinking about? Andrea |