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

Username:   Password: 
 RegisterRegister   
 Font and get
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BryX




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Thu Sep 25, 2003 4:41 pm   Post subject: (No 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
BryX




PostPosted: Thu Sep 25, 2003 6:05 pm   Post subject: (No subject)

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




PostPosted: Thu Sep 25, 2003 7:02 pm   Post subject: (No 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Mazer




PostPosted: Fri Sep 26, 2003 7:56 am   Post subject: (No 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
Blade




PostPosted: Fri Sep 26, 2003 9:19 am   Post subject: (No 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
Tony




PostPosted: Fri Sep 26, 2003 10:26 am   Post subject: (No subject)

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

with just word

then Blade's program should suit your needs
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Blade




PostPosted: Fri Sep 26, 2003 12:01 pm   Post subject: (No 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
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  [ 8 Posts ]
Jump to:   


Style:  
Search: