Computer Science Canada

Font and get

Author:  BryX [ Thu Sep 25, 2003 1:46 pm ]
Post subject:  Font and get

is there anyway to change the font and or size for user input??
eg. when you use get

Author:  Dan [ Thu Sep 25, 2003 4:41 pm ]
Post subject: 

yes and no.

there is no comand to do that other then color of it. but you can make one by using font.draw comands.

what you need to do is use getch to input a char then use font.draw to our put the char to the screen. then you have to do the same over and over intill the user hits enter (you can check for enter being input by checking the ACII code of the char with if's) also you will need to chage the loaction of where the font.draw is outputing the char so it will not overlap.

if you whont to get realy advaced you could check for when the backspace key is hit and then get ride of last font.drawn char.

if you need more help post and i will make up some example or somting of this.

Author:  BryX [ Thu Sep 25, 2003 6:05 pm ]
Post subject: 

i sort of understand what your saying Confused , but if could u post an example that'd be great

Author:  Tony [ Thu Sep 25, 2003 7:02 pm ]
Post subject: 

well to clarify Dan's explanation - do you know how to code your own password input line? the one where input shows as *s?


I'm sure someone posted this before, but here's another quick version of password protection in turing

code:

var pass:string := "tony"
var try:string :=""
var c:string(1) :=""

loop

getch(c)

exit when c=chr(10) %exit when enter is pressed

try += c
locate(1,1)
for i:1..length(try)
put "*"..
end for


end loop

if try=pass then
put "access allowed"
else
put "access denied"
end if


now to have a different font, you replace put "*".. with Font.Draw

Author:  Mazer [ Fri Sep 26, 2003 7:56 am ]
Post subject: 

yeah, i did something like that for my game (for creating accounts and logging in). if you need it i can post up the code for it

Author:  Blade [ Fri Sep 26, 2003 9:19 am ]
Post subject: 

i made something like that a while ago....

code:
View.Set ("nobuttonbar,nocursor")
var letters : string (1)
var word : string (50) := ""
var font : int := Font.New ("Arial:18:Bold,Italic")
var x : int := 100 - Font.Width ("*", font)
loop
    getch (letters)
    exit when ord (letters) = 10
    cls
    if ord (letters) = 8 & length (word) not= 0 then
        word := word (1 .. * -1)
    elsif ord (letters) not= 8 then
        word += letters
    end if
    Font.Draw (repeat ("*", length (word)), 100, 100, font, black)
end loop

Author:  Tony [ Fri Sep 26, 2003 10:26 am ]
Post subject: 

if you replace
(repeat ("*", length (word))

with just word

then Blade's program should suit your needs

Author:  Blade [ Fri Sep 26, 2003 12:01 pm ]
Post subject: 

he said he wanted a password.... so using what i put would be good for password, cuz it wont show letters

wait, maybe i read that somewhere else.... nevermind haha


: