Font and get
Author |
Message |
BryX
![](http://www.boomspeed.com/bryx2002/mini-sephi.gif)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: 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! |
|
|
|
![](images/spacer.gif) |
BryX
![](http://www.boomspeed.com/bryx2002/mini-sephi.gif)
|
Posted: Thu Sep 25, 2003 6:05 pm Post subject: (No subject) |
|
|
i sort of understand what your saying , but if could u post an example that'd be great |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Mazer
![](http://compsci.ca/v3/uploads/user_avatars/1323750815476d9f446d80c.png)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Blade
|
Posted: 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 |
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Blade
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|