
-----------------------------------
Chris Gen 3
Sat Dec 17, 2005 5:07 pm

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

-----------------------------------
Cervantes
Sat Dec 17, 2005 6:00 pm


-----------------------------------
Welcome to CompSci.ca :)

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 
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]
Sat Dec 17, 2005 7:32 pm


-----------------------------------
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. :)

Random point:  When you quote someone who has the Turing Walkthrough in their post, it shows the html link.  Indeed...

-----------------------------------
Cervantes
Sat Dec 17, 2005 7:49 pm


-----------------------------------
"]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. :)

Haha, sweet.
Thanks.  Have some bits.  :)
