Jump to content

  • Log In with Google      Sign In   
  • Create Account

input system


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 jblevins1991   Members   -  Reputation: 99

Like
0Likes
Like

Posted 09 March 2012 - 05:27 PM

void input::init keys(int keys)
{
for(int i=0;i>256;++i)
{
keys[i];
}
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 :D)

Sponsor:

#2 Krohm   Crossbones+   -  Reputation: 3119

Like
0Likes
Like

Posted 10 March 2012 - 01:51 AM

void input::init keys(int keys)
{
    for(int i=0;i>256;++i)
    {
	    keys[i];
    }
    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.

#3 e‍dd   Members   -  Reputation: 2105

Like
0Likes
Like

Posted 10 March 2012 - 04:29 AM

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?

#4 darksheikh   Members   -  Reputation: 102

Like
0Likes
Like

Posted 14 March 2012 - 09:24 AM

what is id tech engine? Is it the platform you are trying to work your code in?
Live Television: http://www.hdlivestreams.com
Online Shopping: http://www.shoppynow.com

#5 SuperVGA   Members   -  Reputation: 1118

Like
0Likes
Like

Posted 14 March 2012 - 09:37 AM

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! Posted Image , 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)

#6 NightCreature83   Crossbones+   -  Reputation: 2827

Like
1Likes
Like

Posted 14 March 2012 - 10:38 AM


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?

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
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#7 ApochPiQ   Moderators   -  Reputation: 15765

Like
1Likes
Like

Posted 14 March 2012 - 11:36 AM

Obligatory reading.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS