View previous topic :: View next topic |
Author |
Message |
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Mon Oct 02, 2006 2:59 pm Post subject: Text input request |
|
|
In FreeUniverse, we sometimes want the player to enter text, however this doesn't cut it:
Code: | arc.io.input.process();
if(arc.io.input.charHit)
{
// add arc.io.input.lastChar to string
}
|
It does not work, since it is possible that two keys are pressed between two calls to process() and we'd only get the last one of the two. Also, if a key is pressed and released before process() is called, charHit will be false. (this could be intentional, but from the docs I expected charHit to mean: the user hit a character between two calls to process)
To remedy this, we have to scan through the whole symbol range with arc.io.input.keyHit(...) to check which characters have been hit and know nothing about the order of keypresses. Is there any way to accomplish this?
It would be helpful if lastChar was the array of characters that have been hit between two calls to process(), maybe with a better name (but I've no good idea myself).
If you agree with this change, I can do it myself (SVN access required) or send you a patch. |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Tue Oct 10, 2006 4:38 pm Post subject: |
|
|
Sorry about the bump, but what are your ideas on this? |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Fri Oct 13, 2006 7:08 am Post subject: |
|
|
Hey I pretty much have a GUI done here ( http://www.dsource.org/projects/arcgames/browser/trunk/arc/gui ) , I'm not 100? sure on what problem you are having, but I've got a 'textfield' to work fine so if you want you could just have me finish and implement the GUI into freeuniverse. |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Sat Oct 14, 2006 8:22 am Post subject: |
|
|
Quote: | I'm not 100? sure on what problem you are having |
Characters of the typed text are missing. Check the FreeUniverse loading screen for it. If you type fast, some characters will be dropped, for the reasons described in the first post. (conceptually, the problem should be platform-independent. I only tested it in Linux)
I will look at your text-input code though. |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Sat Oct 14, 2006 12:44 pm Post subject: |
|
|
Oh alright, you can make the changes to arc in the freeuniverse SVN, that is where I'm going to be developing Arc for a while (because I am developing it to cater to freeuniverse). |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Sun Oct 15, 2006 1:43 am Post subject: |
|
|
Okay. Were you able to reproduce the bug, though? |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Sun Oct 15, 2006 10:08 pm Post subject: |
|
|
I think I know what you are talking about, a while back I was wondering why my text wasn't so responsive
but with a faster computer now it is hard to tell. you can make the change, or ask me to do it, I don't mind. |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Mon Oct 16, 2006 3:40 am Post subject: |
|
|
Okay, I'll make the changes then.
-- edit --
It has been fixed. lastChar renamed to lastChars. |
|
Back to top |
|
|
|