Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Scrolling Text
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
endusto




PostPosted: Sat Mar 05, 2005 1:47 pm   Post subject: Scrolling Text

code:
var font0 : int := Font.New ("Courier New:40:bold")
var message : string := "Andrew is cool"
var messageLength : int :=length ( message ) + 1
var messagePos : int := 0
loop
if (messagePos <  messageLength) then
        Font.Draw (message (1 .. messagePos), 0, 25, font0, blue)
messagePos += 1
delay(100)
end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sat Mar 05, 2005 2:45 pm   Post subject: (No subject)

Very nice.

But you could do it the easy way too - one letter at a time with a delay. Smile
person




PostPosted: Sat Mar 05, 2005 4:58 pm   Post subject: (No subject)

i simplified it a little

code:

var font0 : int := Font.New ("Courier New:40:bold")
var message : string := "person is cool"
var messagePos : int
for x : 1 .. length (message)
    messagePos := x
    Font.Draw (message (messagePos), -30 + x * 30, 25, font0, blue)
    delay (100)
end for


ur code was 11 lines...mine is 8 lines without the if statement
Bacchus




PostPosted: Sat Mar 05, 2005 7:34 pm   Post subject: (No subject)

even smaller, and could prbably be rediced moreso
code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for
endusto




PostPosted: Sun Mar 06, 2005 2:20 pm   Post subject: (No subject)

Bacchus wrote:
even smaller, and could prbably be rediced moreso
code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for


i made it 2 characters shorted by taking out the 0+ in 0+Font.Width

code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for



edit: i also made a horizontal scrolling text Razz
code:
setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold")
var x, y : int
x := 0
y := maxy - 40
loop
if x <= maxx then
cls
x += 1
        Font.Draw ("I dont like yams", x, y, font0, blue)
        View.Update
        delay(5)
end if
if x >= maxx then
x:= 0
end if
end loop
Bacchus




PostPosted: Sun Mar 06, 2005 6:42 pm   Post subject: (No subject)

hm.. i dont kno y i had that zero in there, maybe starting point for text so u could start it in middle of screen etc
ssr




PostPosted: Mon Mar 07, 2005 7:01 pm   Post subject: (No subject)

endusto wrote:
Bacchus wrote:
even smaller, and could prbably be rediced moreso
code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for


i made it 2 characters shorted by taking out the 0+ in 0+Font.Width

code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for



edit: i also made a horizontal scrolling text Razz
code:
setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold")
var x, y : int
x := 0
y := maxy - 40
loop
if x <= maxx then
cls
x += 1
        Font.Draw ("I dont like yams", x, y, font0, blue)
        View.Update
        delay(5)
end if
if x >= maxx then
x:= 0
end if
end loop


code:

setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold")
loop
    for x : - 400 .. maxx + 400
        cls
        Font.Draw ("I don't either", x, maxy - 40, font0, brightblue)
        View.Update
        delay (5)
    end for
end loop

A little different one Very Happy
mike200015




PostPosted: Tue Mar 08, 2005 8:54 pm   Post subject: (No subject)

wow that last ones really nice, not 2 diffucult but looks really good Smile
Sponsor
Sponsor
Sponsor
sponsor
Naveg




PostPosted: Sun Mar 27, 2005 8:45 pm   Post subject: (No subject)

theyre all pretty cool, i especially like the last one
dann_west




PostPosted: Mon May 02, 2005 2:15 pm   Post subject: Re: Scrolling Text

Great!
if its ok i may use that idea in one of my programs!
strike_hawk89




PostPosted: Mon May 09, 2005 9:33 am   Post subject: (No subject)

how would u make the horizontal scrolling text to go to the next line?
Dylan-182




PostPosted: Thu May 12, 2005 2:08 am   Post subject: (No subject)

hey sweet scrolling txt is actually what i was looking for just now lol
MysticVegeta




PostPosted: Sat May 14, 2005 5:03 pm   Post subject: (No subject)

eh what the hell? I cant believe i wasted my time doing this ->
code:
setscreen ("offscreenonly,nobuttonbar,position:truemiddle,centre,graphics:max;max")
var arial : int := Font.New ("arial:50:bold,italic")
var clr : int := 218
colorback (7)
cls
for s : 0 .. 19
    RGB.SetColor (clr, 0, s / 19, 0)
    Font.Draw ("Mystic pWns j0Oz @$$", (maxx div 2) - (maxx div 3), ((maxy - (maxy div 2.1)) - (s + 2)), arial, clr)
    View.Update
    delay (25)
end for
Lapsus Antepedis




PostPosted: Tue May 17, 2005 7:21 am   Post subject: (No subject)

Add a randomized delay (within reasonable limits) and it looks like someone typing at you...
(how pointless is that?)

code:
var font : int := Font.New ("Courier New:15:bold")
var message : string := "It looks like my typing when you randomize the delay"
for x : 1 .. length (message)
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue)
    delay (Rand.Int(10,200))
end for
gohan




PostPosted: Tue May 17, 2005 10:19 am   Post subject: (No subject)

hey MysticVegeta..yours was pretty cool man
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: