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

Username:   Password: 
 RegisterRegister   
 [Module] Custom Text
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Sun Mar 25, 2012 4:10 pm   Post subject: [Module] Custom Text

I've been very annoyed by that fact that I can't use get in offscreenonly mode (or at least not that I'm aware of; tell me if otherwise), so I created a module to do just that. Just import it, and call the fuction Get. There's some info in the file itself, if you want to look more into it. Just note that it exits when you click enter resulting with whatever's on screen, and also exits when you click the escape button, resulting in nothing. The idea for that was to create an option to "go back"; if the function resulted in nothing, then dont continue.

Also yes, I know the input is much glitchier than regular input; so sue me. I did as well as I could, just type slower Razz

Here's a quick example:
Turing:

import "Custom Text.tu"
var word : string := CustomText.Get (50, 200, 200, 12, 4, Font.New ("Arial:10"), brightblue, "Player1: ")


After you click enter or escape, word will now be whatever you typed.



Custom Text.tu
 Description:

Download
 Filename:  Custom Text.tu
 Filesize:  6.6 KB
 Downloaded:  116 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Sun Mar 25, 2012 4:33 pm   Post subject: Re: [Module] Custom Text

Raknarg wrote:
I've been very annoyed by that fact that I can't use get in offscreenonly mode

You can give this a try!
Turing:
View.Set ("offscreenonly")
put "Please Type something!"
View.Update

var test : string := ""
loop
    var ch : char := getchar ()
   
    if ch = "\n" then
        put ""
        exit
    elsif not (ch = KEY_BACKSPACE and length (test) = 0) then
        test += ch
        locate (2, 1)
        put test ..
        View.Update
    end if
end loop

put "You typed: ", test
View.Update


Should work like get.
Raknarg




PostPosted: Sun Mar 25, 2012 5:03 pm   Post subject: RE:[Module] Custom Text

haha fine Razz
But this way you can use customized text, with different fonts and colours and such and still use a get function fine.

Can you do that as well without this?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: