Jump to content

  • Log In with Google      Sign In   
  • Create Account


Game Input Timing


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
1 reply to this topic

#1 Zenroth   Members   -  Reputation: 127

Like
Likes
Like

Posted 23 October 1999 - 05:53 AM

Ok i have recently run into a bit of a problem ive tried a few things to fix the problem,and they didnt work well. So here i am.

Ok i am using directinput for checking keys in my logic loop. Basicly

Keyboard->GetDeviceState( sizeof(diks), &diks );

int KEY(int key){
return diks[key] & 0x80;}

if (KEY(DIK_ESCAPE)) PostMessage(hwnd, WM_DESTROY,0,0);

Ok this works great so far. Now i come to my problem

if (KEY(DIK_UP) && KEY(DIK_LEFT))player1.y-=1, player1.x-=1, player1.dir = DIR_NORTH_WEST;

Ill tell you a bit more bout what im trying to do so that the above might make a little bit more sence. Im using 8-way graphics and i have bitmaps for each direction. The problem is i can never get the diagonal to work. I mean they work if i hold them down but i can't ever get the direction to stay as a diagonal. I guess it sees that one of the direction keys was down for a millisecond longer than the other so it goes up or left ect. So what i need i think is some type of a delay. Sleep(1) works perfectly but kills my framerate very badly.

Any Thoughts on how to get this working?


Sponsor:

#2 Pseudo   Members   -  Reputation: 100

Like
Likes
Like

Posted 23 October 1999 - 05:53 AM

you should never use sleep() in a game.
just use timeGetTime() and set a delay on the input if they just hit a diagonal, or something similar to this.




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