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

Username:   Password: 
 RegisterRegister   
 Computer Engineering TEE201-15
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Chris Gen 3




PostPosted: Sat Dec 17, 2005 5:07 pm   Post subject: Computer Engineering TEE201-15

My teacher cant teach. so can someone tell me how to...

Write a program that allows the user to input any message and then flashes the message, centered on the screen, in all possible colors


-_- would help a lot if u could tell me the Turing code to do this
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Dec 17, 2005 6:00 pm   Post subject: (No subject)

Welcome to CompSci.ca Smile

First, let's get this out of the way: we don't do homework for people. Just making sure we're on the same page.

There are two ways to do this kind of output. The first, and simpler, would be to locate to the centre of the screen, change the colour with color (colour_number : int), and then put the string. Note that if you want to truly centre the string, you'll actually have to locate a bit left of the centre. How much? Well, you want half the string to be left of the centre, and half the string to be right of the centre. Thus, you should locate to the centre column minus half the length of the string. You can determine the length of the string by using the length function.

The second approach is to use fonts. Check up on Font.Draw. To truly centre the string, once again, you'll have to draw the text a bit to the left of the centre. Determining how much left is essentially the same, except this time you need to know the width of the text, in pixels. You can determine this with Font.Draw.

Check [Turing Tutorials] for tutorials on any of the above topics. The Turing Walkthrough should have links to most of them. You can also use the Turing Help manual (F10, in Turing), which is pretty good.

[edit] Oh, as for cycling through colours, it's easiest with a for loop:
code:

for colour_index : 0 .. 255
    color (colour_index)
    locate (1, 1)
    put "my text"
end for


We've also got a tutorial on for loops, if you need it. There's a link in the Turing Walkthrough.
[Gandalf]




PostPosted: Sat Dec 17, 2005 7:32 pm   Post subject: (No subject)

Cervantes wrote:
Determining how much left is essentially the same, except this time you need to know the width of the text, in pixels. You can determine this with Font.Draw.

You mean Font.Width. Smile

Random point: When you quote someone who has the Turing Walkthrough in their post, it shows the html link. Indeed...
Cervantes




PostPosted: Sat Dec 17, 2005 7:49 pm   Post subject: (No subject)

[Gandalf] wrote:
Cervantes wrote:
Determining how much left is essentially the same, except this time you need to know the width of the text, in pixels. You can determine this with Font.Draw.

You mean Font.Width. Smile

Haha, sweet.
Thanks. Have some bits. Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: