Archived

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

PeterFree8

How to use DXInput correct?

Recommended Posts

Hey... I''ve been trying to figure DXInput out, but I really can''t seem to find it very useful! I have my game with some simple functions... Eg. move up, down, left, right, jump and shoot. So now I want to make a Configure keys setup screen, like every game have, but how do i do that? Can anybody point me in the correct way to save/load user defined keybindings? This was how I wanted to do it: - First I created some vars (iMoveUp, iMoveDown, etc...) which should be the Hex or Integer value for the key that the user have choosen. - Then I would simply do this in my game loop: If iMoveUP = GetKey(KeyValue) Then DoMoveUP; If iMoveDown = GetKey(KeyValue) Then DoMoveDown; etc... But as the function GetKey doesn''t exist I have to make that function my self, but I really can''t find any way to get DXInput to show what key I pressed!? Any help on DXInput would be nice... Btw... anybody who knows how they did the "bind w forward" thing in Quake, and other 3D-shooters?.. and maybe how to make such a function in our own games?

Share this post


Link to post
Share on other sites
int nW = 0; // 0 is up
int nA = 1; // 1 is left
int nS = 2; // 2 is down
int nD = 3; // 3 is down

long Bind( char key, int function )
{
switch( key )
{
case 'W': nW = function; break;
case 'A': nA = function; break;
case 'S': nS = function; break;
case 'D': nD = function; break;
default: return FALSE;
}
return TRUE;
}

Crap this is turbo-forum...


Maybe somthing like this?

.lick

[edited by - Pipo DeClown on January 18, 2003 7:05:20 AM]

Share this post


Link to post
Share on other sites