Jack Language Password Mini-project

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jack Language Password Mini-project

SchwerToMe
Hello all, I'm trying to build jack code that would emulate entering a username and password. Obviously the username part is easy, but I'm not sure how to implement a method of having someone type in some string but it not showing up in the VMEmulator.

Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Jack Language Password Mini-project

cadet1620
Administrator
You will need to write your own readPasswordChar() function since Keyboard.readChar() echos the typed key.

It will look something like this:  (pseudo Jack)
    function char readPasswordChar() {
        // wait for key pressed
        while ((key = Keyboard.keyPressed) = 0) {}
        do Output.printChar(0);    // print a blob
        // wait for key released
        return key;
    }
You could be more sophisticated and write a readPasswordString(int maxSize) function that would allocate a String and read the typed keys into it.

--Mark