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

Username:   Password: 
 RegisterRegister   
 Speculated Input.KeyDown Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dragon20942




PostPosted: Sun Jun 08, 2014 6:02 pm   Post subject: Speculated Input.KeyDown Problem

What is it you are trying to achieve?
I have created a program that successfully outputs the ordinal values of different characters. However, there is an interesting thing that I noticed that I would like explained.


What is the problem you are having?
. There seems to be a maximum number of keys that are registered as pressed a one given time. This number also seems to vary based on which keys are pressed. For example, if I press 'a','s','d','f', and '3' in combination, only 'a','d', and '3' might appear on the screen. If I let go of 'd', I might be able to put both 's' and 'd' in as well. However, these combinations seem to be constant. The page on Input.KeyDown explains that detection is minimum two keys in conjunction with shift, ctrl, and alt, but if it were possible, I would like to devise specific combinations of keys which have the highest simultaneous registering.

Describe what you have tried to solve this problem
I tried adding the values, and looking up Input.KeyDown.
I also tried to do some experimentation:

Example:
a s d f j k l ; p will all register simultaneously

a s v b works, but a s b v will not let v register

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


View.Set ("offscreenonly")
var chars : array char of boolean
var pressed : array 0 .. 255 of boolean
for i : 0 .. 255
    pressed (i) := false
end for

loop
    Input.KeyDown (chars)
    for i : 0 .. 255
        if chars (chr (i)) then
                put chr (i), " -> ", i
        else
            pressed (i) := false
        end if
    end for
    View.Update
    delay (5)
    cls
end loop


Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Sun Jun 08, 2014 6:28 pm   Post subject: Re: Speculated Input.KeyDown Problem

The problem actually has to do with the physical keyboard (try using different keyboards and see if you get different results).

I believe this is called key rollover. Basically the ability of a keyboard to properly detect multiple keys being pressed at once.

EDIT: can't get url to work (maybe I'm forgetting how to do this...) look it up for more info. Smile
Raknarg




PostPosted: Sun Jun 08, 2014 7:54 pm   Post subject: RE:Speculated Input.KeyDown Problem

Neat little turing trick:
Turing:

View.Set ("offscreenonly")
var chars : array char of boolean
loop
    Input.KeyDown (chars)
    for ch : char
        if chars (ch) then
                put ord(ch), " -> ", ch
        end if
    end for
    View.Update
    delay (5)
    cls
end loop


The keyword "char" isn't magic, it actually means a range containing all char values. So when you say array char of boolean, you're actually creating an array where the range is all the characters, and each index is a different character. I've discovered Turing actually has some cool set and range properties
Dragon20942




PostPosted: Sun Jun 08, 2014 7:58 pm   Post subject: RE:Speculated Input.KeyDown Problem

Yeah, key rollover seems like the problem, thanks! It looks like to actually have a foolproof method of determining which combinations of keys work, you have to download detector software
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: