void input::init keys(int keys)
{
for(int i=0;i>256;++i)
{
keys;
}
keys[0];
keys[1];
keys[2];
....more keys
}
i am looking for a way to assign a key to an element of this array. so i could make keys[0] store the 'a' key. can somebody point me in the right direction?
(inspired by id tech engine )
input system
void input::init keys(int keys)
{
for(int i=0;i>256;++i)
{
keys;
}
keys[0];
keys[1];
keys[2];
//....more keys
}
For a start, I am not well aware of what this code is intended to do. Perhaps operator[] is overloaded? I have no idea of how ID tech manage those things.
2nd: please take note there's no such thing as 'a' key, being 'a' a character that can be generated by various methods. I strongly suggest to separate the notion of button from the notion of characters. It could look like
keys[0] = KBTN_A;
Does this help you? Probably not. I'm afraid you need to elaborate your questions.
i am looking for a way to assign a key to an element of this array. so i could make keys[0] store the 'a' key. can somebody point me in the right direction?
Are you asking how to poll the keyboard? If so, on what platform. On Windows you might use DirectInput.
Or are you asking what kind of data structures might be used for configurable key mapping?
Maybe you can be inspired by this too: http://www.gamedev.n...y-binding-in-c/
@deksheikh: Probably ID Tech .... by ID Software. If this was the OpenGL forum, I'd say you should know that! , but here I won't nag...
Anyways, unless you want a way to store or some pattern to fire or catch key events, polling they keys etc, this is not a very General question.
Keystrokes are very much platform(and framework) specific, actually. Also, the only thing I can spot that even remotely connects ID Tech with keybindings is that
they're using them. Their first game with Keybindings was Quake AFAIK, (Which was really using the Quake Engine, as they didn't call it "ID Tech 1" back then)
@deksheikh: Probably ID Tech .... by ID Software. If this was the OpenGL forum, I'd say you should know that! , but here I won't nag...
Anyways, unless you want a way to store or some pattern to fire or catch key events, polling they keys etc, this is not a very General question.
Keystrokes are very much platform(and framework) specific, actually. Also, the only thing I can spot that even remotely connects ID Tech with keybindings is that
they're using them. Their first game with Keybindings was Quake AFAIK, (Which was really using the Quake Engine, as they didn't call it "ID Tech 1" back then)
[quote name='jblevins1991' timestamp='1331335636' post='4920797']
i am looking for a way to assign a key to an element of this array. so i could make keys[0] store the 'a' key. can somebody point me in the right direction?
Are you asking how to poll the keyboard? If so, on what platform. On Windows you might use DirectInput.
Or are you asking what kind of data structures might be used for configurable key mapping?
[/quote]
Be advised that MS has advised people to not use DirectInput for keyboards and instead use RawInput. http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864(v=vs.85).aspx
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement