Jump to content
  • Advertisement
Sign in to follow this  
QuackCoder

[web] Getting multiple key input and confusing keycodes

This topic is 2603 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1. So how do I listen for multiple (simultaneous) key inputs? I can only listen for one.
2. Lowercase and Uppercase character have different key codes. Is there a way to deal with them rather than hard coding?

EDIT: Using javascript

Share this post


Link to post
Share on other sites
Advertisement
It would be helpful to know what languege you use and what api you are using for inputs.

1. What do you mean with "listening"? Normally you should have an array bool keys[256] and set a certain position to true if a certain key is pressed. That way you can check for as many keys as you'd want at the same time.

2. For c++ and the windows api, lower and uppercase didnt make a differnce so far for me. As I said, tell us what you are working with..

Share this post


Link to post
Share on other sites

It would be helpful to know what languege you use and what api you are using for inputs.


I using plain old javascript.

<!DOCTYPE html>
<html>
<head>
<title>page</title>
<script type="text/javascript">
function addEventListener(){
function getKey(e){
var keyCode = e.which || e.keyCode;
return keyCode;
}
document.addEventListener('keydown', getKey, false);
}
</script>
</head>
<body onload="addEventListener()">
</body>
</html>

But this would give me only one keycode.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!