I am trying to sense multiple keys at a time and I am wondering how to use a hash map to do this.
sirlink99
56
Practically a Master Poster
Recommended Answers
Jump to PostWhat do you mean? A hashmap maps key,value pairs - is that the sense of "key" you mean, or are you talking about "key" as in "keyboard" or do you mean "key" as in crypto, or what do you mean?
Jump to PostYou don't use hash maps to sense keyboard keys, you use keyboard listeners for that.
Are you talking about handling a multiple key press scenario after it's detected? Like, user presses 'a', 'd', and 'e' at the same time?
I can imagine one way to do that using a …
Jump to PostYou'll probably need to use keypressed and keyreleased.
When keypressed fires, if the firing key is "CTRL" set a flag, controlDown, to true
When keyreleased fires, if the firing key is "CTRL", set that flag to falseIf keypressed fires, and the firing key is "SPACE", check that …
All 12 Replies
jon.kiparsky
326
Posting Virtuoso
sirlink99
56
Practically a Master Poster
mKorbel
274
Veteran Poster
jon.kiparsky
326
Posting Virtuoso
sirlink99
56
Practically a Master Poster
jon.kiparsky
326
Posting Virtuoso
sirlink99
56
Practically a Master Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
sirlink99
56
Practically a Master Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
sirlink99
56
Practically a Master Poster
mKorbel
274
Veteran Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.