Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Guest

Getting input under windows....

This topic is 7049 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

Hi - Will need the code 'fraid - or more detal than given - Send it to me if you want and I'll try to look at it (just coded a DirectX Input interface so still fairly fresh) - I assume by dinput you are using DirectX?
mikeb@pavilion.co.uk

Share this post


Link to post
Share on other sites
Advertisement
Rather than haveing to code a huge switch statement (or many if statements) using Direct Input, I would let the Window's messiging system take care of it. Here is how I would go about getting the input for a name:

case WM_CHAR:
index = strlen( name );
name[ index ] = (char)wParam;
return FALSE;

This is obviosly a case statment in your window's procedure function, and it also assumes a few things. name is assumed to be an array of type char (long enough to hold the name).

You would also need to add checking to ensure that that char added to the string is a valid char to add.

Share this post


Link to post
Share on other sites
Guest
I'm trying to get input from the keyboard for recording there name for the high-scores. I've tried to write a function using dinput that went somthing like this:
...
if(isdown(DIK_K){
the_char='K';
}
if(isdown(DIK_L){
the char='L';
}
...
all it ever returns is spaces... I'v initalized the_char to likes like ¥ or º and the like so I could tell if a key was even pressed.

then I tried using VK_* but I get compiling errors with them...

then I tried using the WM_CHAR but that dosen't work eather...(all spaces)

then Finaly I tried things like getch() and cin... but like I figured they didn't work eather...

If you need to see the actual code let me know...

------------------
Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

Share this post


Link to post
Share on other sites
Guest
thanks all... it works now.

------------------
Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!