Colouring
Author |
Message |
nonamedude
|
Posted: Wed Jun 03, 2009 6:15 pm Post subject: Colouring |
|
|
What is it you are trying to achieve?
Color specific text instead of making it coloring all the text under the code
What is the problem you are having?
Colors all the text under the code same with colourback(1)
Describe what you have tried to solve this problem
Nope no solution yet
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Please specify what version of Turing you are using
4.1.1.0 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:00 pm Post subject: Re: Colouring |
|
|
Anyone, and another question is that if i
colourback (1)
or any other colour i cant import / put anything on the background, it just stays that colour
Font.Draw ("Hello World", 300, 373, font1, red)
for eg the code above will not appear |
|
|
|
|
|
Dusk Eagle
|
Posted: Wed Jun 03, 2009 7:03 pm Post subject: Re: Colouring |
|
|
For simple text coloring, simply use color (). For more advanced stuff, use Font.Draw. |
|
|
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:06 pm Post subject: Re: Colouring |
|
|
ok thats covered but if i colour the background black
colourback(1)
then i put this its not working
Font.Draw ("Hello World", 300, 373, font1, red)
i did declare the variable and the font and tested it on a blank sheet and it works but on the black background it does not work |
|
|
|
|
|
Dusk Eagle
|
Posted: Wed Jun 03, 2009 7:08 pm Post subject: Re: Colouring |
|
|
So you're saying that Font.Draw () does not work with colorback? That's because colorback () uses the screen in text mode, and Font.Draw uses the screen in graphics mode. To do the same thing as colorback (), use Draw.FillBox () behind (i.e. before) the text. |
|
|
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:15 pm Post subject: Re: Colouring |
|
|
Turing: |
var page : int
var font1 : int
procedure fonta
font1 := Font.New ("comicsans:14:bold,underline")
Font.Draw ("Hello World", 300, 373, font1, red)
end fonta
procedure me
put "Choose page"
put "page1"
put "page2"
get page
if page = 1 then
put "test"
put ""
put ""
Font.Draw ("Hello World", 300, 373, font1, red)
else
if page = 2 then
put "test"
put ""
put ""
put ""
Font.Draw ("Hello World", 300, 373, font1, red)
end if
end if
end me
colourback (3)
put "Test"
put ""
put ""
put ""
put ""
put ""
put ""
fonta
me
cls
|
y does that not work if it is in a procedure? |
|
|
|
|
|
Dusk Eagle
|
Posted: Wed Jun 03, 2009 7:24 pm Post subject: Re: Colouring |
|
|
You are cls'ing at the end. If you comment that out I think you'll get what you want. If not, could you detail exactly what it is you want done?
A couple things with your code though. Have you heard of elsif? It is far better than using
Also, rather than using global variables for everything, you should look into using parameters with your procedures. This is a far better programming method to use, as programs that use global variables become unmaintainable as programs get larger. |
|
|
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:30 pm Post subject: Re: Colouring |
|
|
OK gimme a sec its a pretty long code i'll try and shorten it |
|
|
|
|
|
Sponsor Sponsor
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:43 pm Post subject: Re: Colouring |
|
|
Ok all i need is too do this but display the font at the top of each veg
its JUST an example, i just wrote it soo if there is a mistake then please understand
Turing: |
var answer : string
var vegy : int
var quantity : array 1 .. 3 of int
var font1 : int
font1 := Font.New ("comicsans:14:bold,underline")
procedure display
put "Hello this is a vegetable store"
put "this is what we have today"
put "1.lettuce"
put "2.carrot"
put "3.tomato" %--------------- i put this for fun lol i know its not a vegetable
put "What do u want (enter number only)"
get vegy
end display
procedure veggies
if vegy = 1 then
Font.Draw ("Lettuce", 300, 373, font1, red)
put "Ahhhhh this is a good vegetable"
put "how many ?"
get quantity (1)
elsif vegy = 2 then
Font.Draw ("Carrot", 300, 373, font1, red)
put "Not a bad choice"
put "how many?"
get quantity (2)
elsif vegy = 3 then
Font.Draw ("Tomato", 300, 373, font1, red)
put "This ain't no vegetable its a fruit"
put "How many"
get quantity (3)
end if
end veggies
loop
colourback (7)
colour (0)
display
cls
veggies
put "Want more Veggies?"
get answer
exit when answer = "no"
cls
end loop
|
|
|
|
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 7:55 pm Post subject: Re: Colouring |
|
|
I will be away for an hour or 2 so if i dont answer you will know why, sorry |
|
|
|
|
|
ecookman
|
Posted: Wed Jun 03, 2009 8:08 pm Post subject: Re: Colouring |
|
|
@ Dusk Eagle
wouldn't that just make the box go at the top of the screen... don't you need to use the locate function?[/code] |
|
|
|
|
|
Dusk Eagle
|
Posted: Wed Jun 03, 2009 8:13 pm Post subject: Re: Colouring |
|
|
If you're talking about the Draw.FillBox () procedure, it will go wherever you specify it to go. If you're talking about the colorback () procedure, it goes on the same line as the text cursor is currently on. |
|
|
|
|
|
ecookman
|
Posted: Wed Jun 03, 2009 8:31 pm Post subject: RE:Colouring |
|
|
ooh...i thought you meant that putting the drawfillbox function before the text one it would put the box around that and i was like....never seen that happen before. |
|
|
|
|
|
nonamedude
|
Posted: Wed Jun 03, 2009 9:29 pm Post subject: Re: Colouring |
|
|
I would be gratefull if you guys gave me a simple example... |
|
|
|
|
|
|
|