Getting with Font
Author |
Message |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Thu Oct 19, 2006 11:32 am Post subject: Getting with Font |
|
|
Well, I've seen the question a couple times "Can you get, and have the text show in a specific font?". So I decided to create a function to show that it is possible. Here is the code:
Turing: |
function gets (xpos, ypos, font, clr : int) : string
var a : string (1)
var word : string := ""
loop
getch (a )
exit when a = '\n'
if word ~ = "" and ord (a ) = 8 then
word := word (1 .. * - 1)
else
if a ~ = "\b" then
word + = a
end if
end if
cls
Font.Draw (word, xpos, ypos, font, clr )
end loop
result word
end gets
|
an example of its use:
Turing: |
var name : string := ""
put "Please enter your name"
name := gets (0, 0, Font.New ("times new roman : 20"), red)
|
all you need for this function to function (no pun intended) properly is an ordered pair (x,y) coordinates, your font, and a color to display the font in. Have fun with it if you want to use it. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Prince Pwn
|
Posted: Tue Jan 02, 2007 6:12 pm Post subject: (No subject) |
|
|
This is cool! |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Tue Jan 02, 2007 6:18 pm Post subject: (No subject) |
|
|
It's not perfect, for instance it clears the screen every iteration through a loop, so if you have anything on the screen, you will lose it. It's just a rough model to work with. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Tue Jan 02, 2007 7:44 pm Post subject: (No subject) |
|
|
well, once it's done this would be pretty useful |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Tue Jan 02, 2007 7:53 pm Post subject: (No subject) |
|
|
I don't plan on finishing it. The only reason I posted was because people kept asking if it could be done. So I posted a half done version to prove the point, and have them do the work instead of saying "This is Freakman of compsci.ca's 'gets' function, but I have no idea how it works". |
|
|
|
|
![](images/spacer.gif) |
lord
|
Posted: Mon Jan 15, 2007 9:23 pm Post subject: Re: Getting with Font |
|
|
to be to the point ....................................................................................................... :!:LOL ![Exclamation Exclamation](images/smiles/icon_exclaim.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|