Posted: Sat May 21, 2005 1:56 pm Post subject: (No subject)
how would u make the text go to the next line? If any of you have noticed, when the text goes past the window border the program doesnt stop.
Sponsor Sponsor
Delos
Posted: Sat May 21, 2005 3:14 pm Post subject: (No subject)
You'd need to do some length calculations. Since Font.() commands render the text as a picture, you can have it return the length of a particular string in a particular font setup. Use Font.Width() to find the length of the string you're using.
Then, limit the allowed width per 'line' to the length of the screen. Figure out which letter that would be.
Cut the string up into sections and recall the 'scroll' routine on the new text.
RaPsCaLLioN
Posted: Sat May 21, 2005 7:46 pm Post subject: (No subject)
code:
var iWindow : int := Window.Open ("offscreenonly, graphics:640;200, noecho, nocursor")
var iFont := Font.New ("Courier New:40:bold")
var message : string := "WHOOOAAAAA!!!"
var rArb, rTime, j : real
loop
rTime := Time.Elapsed / 10
for i : 1 .. length (message)
Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont), round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 85, iFont, blue)
end for
Window.Update (iWindow)
cls
end loop
and...
code:
var iWindow : int := Window.Open ("offscreenonly, graphics:640;200, noecho, nocursor")
var iFont := Font.New ("Courier New:50:bold")
var message : string := "WHOOOAAAAA!!!"
var rArb, rTime, j : real
loop
rTime := Time.Elapsed / 10
for i : 1 .. length (message)
Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont), round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 85, iFont, black)
Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont) - 2, round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 87, iFont, white)
end for
Window.Update (iWindow)
cls
end loop