Questions tagged [keyboard]

Often the primary input for computer games. It boasts a very large versatility for direct input.

Filter by
Sorted by
Tagged with
12 votes
5 answers
14k views

Keyboard input system handling

Note: I have to poll, rather than do callbacks because of API limitations (SFML). I also apologize for the lack of a 'decent' title. I think I have two questions here; how to register the input I'm ...
PrettyPrincessKitty FS's user avatar
11 votes
7 answers
3k views

Keyboard shortcuts in RTS game

Imagine you have a multiplayer RTS game (e.g. Dune, Age of Empires, Settlers, Warcraft). There are certain commands available from keyboard to command the troops (Stop, Attack, Move) and some more ...
Kromster's user avatar
  • 10.6k
11 votes
4 answers
8k views

How can I handle different keyboard layouts?

Let's say I have a game that uses WASD controls on a QWERTY layout. Trying to use these controls on, say, a Dvorak layout is not ideal (equivalent to <A:H on ...
beatgammit's user avatar
11 votes
5 answers
17k views

Handling keyboard and mouse input (Win API)

There is a number of ways to catch mouse or keyboard under Windows. So I tried some of them, but every of them has some advantages and drawbacks. I want to ask you: Which method do use? I've tried ...
Deluxe's user avatar
  • 143
11 votes
2 answers
2k views

Portable buffered keyboard input for XNA / MonoGame?

As a preliminary solution, I am currently using the Nuclex framework (see note below) in an C#/XNA game project for buffered keyboard input. Sadly, Nuclex relies on SlimDX.Directinput.dll and ...
ares_games's user avatar
9 votes
2 answers
5k views

Removing delay at start of a key press

I'm making a simple game, and one of the problems I encountered is the annoying delay when pressing a key continuously. So basically, when I press (for a very long time) for example Up, my object ...
Rakete1111's user avatar
9 votes
2 answers
8k views

How can I forward GLFW's keyboard input to another object?

I'm having trouble trying to execute keyboard events in a another class with GLFW3. The problem I'm having is that GLFW3 uses a static function for input as shown: ...
ChocoMan's user avatar
  • 741
9 votes
3 answers
2k views

Key combinations on poll-based input

So assume you have an input system that is based on polling void update() { if( Keyboard[ 'A' ] ) // A is down } Say you want to be able to recognize ...
bobobobo's user avatar
  • 17.1k
8 votes
1 answer
532 views

Javascript keyDown - no event approach

I'm making game in JavaScript. I have canvas for drawings and game loop. I'd like to make method readKeyboard, in game loop, to check if there is any pressed key. I don't want to attach event to ...
Piotr Łużecki's user avatar
8 votes
3 answers
21k views

How do I simulate the mouse and keyboard using C# or C++?

I want to start develop for Kinect, but hardest theme for it - how to send keyboard and mouse input to any application. In previous question I got an advice to develop my own driver for this devices, ...
Dracontis's user avatar
  • 229
7 votes
7 answers
330 views

Ergonomics studies on choosing keys on a keyboard?

I have the following problem: My game supports multiple powers, that you can use when you want, or even mix them, I currently assigned them to the numbers on the top of the keyboard. After so much ...
speeder's user avatar
  • 1,392
7 votes
3 answers
10k views

How do I read input from multiple keyboards/mice on one computer?

I want to be able to read inputs from multiple keyboards and still differentiate them. It's for split-screen. I know it's possible, because Serious Sam 3 allows it. Edit : Well a whole lot of my ...
DevilBlackDeath's user avatar
6 votes
3 answers
1k views

How do I accept only one directional input per update?

I'm coding "Snake" as my first game and I'm facing the logical fail when pressing multiple keys simultaneously eg. { up, right}; {up, left}; {down, right}, etc. Snake is able to go back and forth and ...
Sithideth Bouasavanh's user avatar
6 votes
3 answers
2k views

SDL Multiple keyboard support

I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to ...
Sunius's user avatar
  • 201
6 votes
2 answers
339 views

Which code module should map physical keys to abstract keys?

How do you bridge the gap between the library's low-level event system and your engine's high-level event system? (I'm not necessarily talking about key events, but also about quit events.) At the ...
Paul Manta's user avatar
  • 3,177
5 votes
3 answers
5k views

How can I stop looking for keyboard input for a length of time?

I'm pretty new to programming, and even newer to C# and XNA. I currently call a method that looks for keyboard input in my Update method. This method has if statements for doing what needs to be done ...
Matt's user avatar
  • 53
5 votes
4 answers
5k views

Multiple Key Presses in XNA?

I'm actually trying to do something fairly simple. I cannot get multiple key presses to work in XNA. I've tried the following pieces of code. ...
Nayrb's user avatar
  • 745
5 votes
3 answers
36k views

Java - Best Implementation KeyListener For Games

I am working on a game using only the swing and awt packages. Note I can only use the default Java libs. Meaning I have to use KeyListener. I have imported KeyListener properly, however, it is still ...
NateAGeek's user avatar
  • 173
5 votes
3 answers
3k views

LibGdx TextField - How to hide Keyboard when not focused?

I'm creating a registration screen for my game. I implemented textfields and input is getting correctly. But when I click elsewhere after text is entered, the keyboard stays visible and does not hide ...
Neerkoli's user avatar
  • 479
5 votes
3 answers
9k views

What are reasons for input polling vs. input events?

I noticed people use both - but is there any empirical evidence when it's better to use one over the other? This is related but not quite a 'why use either' or even 'why use both': Polling vs event ...
Vaughan Hilts's user avatar
5 votes
2 answers
648 views

Pygame fails on KEYDOWN with Russian keyboard layout

When I press a keyboard button on a keyboard with a Russian layout, my application pygame game crashes with this message: UnicodeEncodeError: 'ascii' codec can't encode character '\u0444' in ...
Vlad's user avatar
  • 101
5 votes
2 answers
1k views

Accept keyboard input when game is not in focus?

I want to be able to control the game via keyboard while the game does not have focus... How can I do this in XNA? EDIT: I bought a tablet. I want to write a separate app to overly the screen with ...
Corey Ogburn's user avatar
  • 1,125
4 votes
6 answers
21k views

RPG movement holding down button

I've been writing a simple top down mini RPG in python. My problem is that when I move the player I have to repeatedly tap the arrow key. Each time I tap the key the player moves 5 PX in the ...
Cnorwood7641's user avatar
4 votes
4 answers
3k views

Key mapping for a 2-players game

I've been struggling for a while trying to figure out the best way to map two players on a single keyboard. Let's consider something generic: Arrows Validation Cancel (optional) Some common actions ...
Vincent's user avatar
  • 143
4 votes
3 answers
1k views

Send regular keyboard samples OR keyboard state changes over network

Building a multi player asteroids game where ships compete with each other. Using UDP. Wanted to minimize traffic sent to server. Which would you do: Send periodic keyboard state samples every from ...
Ciaran's user avatar
  • 401
4 votes
1 answer
723 views

Swing KeyListener doesn't work when pressing Shift X Z and directions at the same time

My code: ...
ice1000's user avatar
  • 286
4 votes
1 answer
2k views

In GLUT, how do I bind an action to a press of "any key"?

Well, this sound ridiculous but the logic is escaping me. I have drawn my cube in OpenGL and I want to translate it to the right if any of the key on the keyboard is pressed. I know how to do this for ...
CN1002's user avatar
  • 179
3 votes
4 answers
4k views

Twin stick shooting with keyboard

In a top down shooting game, what alternatives are there for input if I want the direction of movement to be independent from the direction I'm shooting at? I'd like to avoid shooting with the mouse ...
Martin Epsz's user avatar
3 votes
2 answers
409 views

How can I support remappable controls?

I am trying to allow players of my game to remap the controls (eventually from the menu). Currently, some of the buttons have been defined, but they can't be changed. They are hard-coded. For example, ...
cluemein's user avatar
  • 173
3 votes
1 answer
400 views

How to handle complex inputs in 2D platform game?

I am trying to add keyboard control for my character in 2D platform game with JavaScript. The character can walk, dash and jump. Here is my current code: ...
undefined000's user avatar
3 votes
2 answers
7k views

Receiving keyboard events on a canvas in Javascript

I need to receive keyboard events in a canvas element. Click events are received but key presses aren't. Here is my code which doesn't handle key events: ...
Whispered's user avatar
  • 205
3 votes
2 answers
11k views

Change key setting from qwerty to azerty in Unity

How can I change the default key for walking with the player in Unity. At this moment I can do this with A, W, D and S (or something). But because I work with an azerty keyboard, I'll change it to Z, ...
H. Pauwelyn's user avatar
3 votes
3 answers
3k views

Efficiently checking input and firing events

I'm writing an InputHandler class in XNA, and there are several different keys considered valid input (all of type Microsoft.XNA.Framework.Input.Keys). For each key,...
yoozer8's user avatar
  • 1,134
3 votes
1 answer
2k views

Handling Ctrl-<key> shortcuts in Unity, respecting user preferences

I am implementing some software with Unity that needs to support Ctrl-<key> shortcuts such as Ctrl-c. I want to do this in ...
David Zhao Akeley's user avatar
3 votes
1 answer
657 views

Why do I have delays when pressing a keyboard key continuously to move the character?

What happens is I press right for a fraction of a second then release and my character moves to the right, as it is supposed to. I then press right again but this time for 5 seconds. My character ...
Seb0029's user avatar
  • 93
3 votes
2 answers
136 views

What is the best way to close dialogs in a platform game controlled by keyboard only

I'm developing a flash puzzle platform game in my free time and I got stuck on deciding how to implement a feature. The game will be controlled by keyboard only, no mouse available. My game will have ...
yannicuLar's user avatar
3 votes
1 answer
228 views

How to identify individual keyboard keys across devices from different locales

I'm trying to make a UI system that adapts images for key binding depending on the keyboard type (azerty/qwerty/etc). For the moment I've done the binding with DirectInput Key Codes so it does not ...
Zeldarck's user avatar
3 votes
1 answer
2k views

Getting the height of Keyboard on Android

Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D-X but the app don't recognize the keyboardWillShow method. Thanks
magorich's user avatar
  • 175
3 votes
1 answer
751 views

XNA 2D Board game - trouble with the cursor

I just have started making a simple 2D board game using XNA, but I got stuck at the movement of the cursor. This is my problem: I have a 10x10 table on with I should use a cursor to navigate. I ...
Adorjan's user avatar
  • 31
3 votes
1 answer
241 views

How to handle keyboard controls in Arkanoid game

I'm making simple Arkanoid clone in Unity with both keyboard and mouse controls available. When I gave it to my colleagues to test one complain was that keyboard controls are not precise enough,. The ...
anomaly's user avatar
  • 49
3 votes
1 answer
651 views

LibGDX: How to detect remote button press for Android TV?

On Android TV, I need to be able to detect the remote control centre button to start the game. I tried: ...
Lim Thye Chean's user avatar
3 votes
2 answers
3k views

Is there a universal method to send key or mouse input to any application from C#?

I need method or group of them to send signals to any application (browsers, games, et cetera) about mouse movement or key input. I can easly retrieve an IntPtr to any process, but I don't know what ...
Dracontis's user avatar
  • 229
2 votes
4 answers
13k views

SDL - Getting a single keypress event instead of a keystate?

Right now I'm working on a simple SDL project, but I've hit an issue when trying to get a single keypress event to skip past a splash screen. Right now, there are 4 start-up splash screens that I ...
MrKatSwordfish's user avatar
2 votes
5 answers
10k views

How to pause and resume a game in XNA using the same key?

I'm attempting to implement a really simple game state system, this is my first game - trying to make a Tetris clone. I'd consider myself a novice programmer at best. I've been testing it out by ...
user avatar
2 votes
2 answers
3k views

LWJGL multiple keyboard/mouse input checks

As in many game libraries such as LWJGL, you can check mouse/keyboard events with Mouse.isButtonDown or Keyboard.IsKeyDown. I want to check for button/key presses, not if it's currently pressed down (...
Basaa's user avatar
  • 1,053
2 votes
2 answers
7k views

camera movement along with model

I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this. The cube needs to have a smooth movement like it is traveling on a ...
noddy's user avatar
  • 647
2 votes
1 answer
109 views

Detect if a key other than "this" key has been pressed

I'm wondering if there is a way to detect if the key being pressed is NOT matching a specific KeyCode. I tried using: ...
sammyiscuul's user avatar
2 votes
1 answer
3k views

Triggering Enhanced Input Actions via inputs with modifier keys (Shift/Alt/Ctrl) in UE5

This question refers to the use of enhanced input in Unreal Engine 5. Whenever I say "modifier", I refer to modifier keys such as Shift, Alt, and Ctrl (rather than the Input Modifers such as ...
Simon Fischer's user avatar
2 votes
1 answer
100 views

How does XNA's KeyboardState represent all keyboards?

I already understand how to work with Keyboard and KeyboardState, but when debugging I happened to take a look at the ...
Kyle Baran's user avatar
2 votes
2 answers
222 views

Deactivate keyboard input on collision

I'm creating an online-canvas-game with a tank as player object. Now I have several structures in my canvas, that shouldn't be able to be overdriven by the tank... My solution is to detect the ...
Philip's user avatar
  • 29