G
Guest
I've had two issues plaguing me for 4 months now and I haven't gotten
anywhere. I'm into making 2D games and these things are essential to games.
These are my issues:
1. I need timing precise to about 4 milliseconds at most. Currently, I've
been using the clock() function, but it's only precise to 1/64 second (or
about 15.6 milliseconds). For those running their monitor at 60 Hz, this
isn't much of a problem, but for those running above 64 Hz (70 and 75 are
common), this would mean either processing two frames in one causing jerky
motions, or running at half the refresh rate. By using something with 4
milliseconds precision, up to 250 Hz works and the highest I've seen is 160
Hz. There's another one with 1/4 microsecond precision, but that's not
supported by every system and it's far more than I need. How do I get the 4
millisecond timing I'm after?
2. Lastly, how do I tell if a key is pressed or not. That is, if I press
the right arrow key, I expect the character to move right. I know how to
program the movement (and practically everything else in a 2D game like an
RPG), but I don't know how to tell if a key is pressed or not.
These are my requirements:
1. It must work with systems as old as Windows 95.
2. It must not use DirectX. If it is required for either of these, then
something that works with Windows 95. I strongly prefer going without
DirectX though.
I'm using Visual C++ 2005 Express if that helps.
anywhere. I'm into making 2D games and these things are essential to games.
These are my issues:
1. I need timing precise to about 4 milliseconds at most. Currently, I've
been using the clock() function, but it's only precise to 1/64 second (or
about 15.6 milliseconds). For those running their monitor at 60 Hz, this
isn't much of a problem, but for those running above 64 Hz (70 and 75 are
common), this would mean either processing two frames in one causing jerky
motions, or running at half the refresh rate. By using something with 4
milliseconds precision, up to 250 Hz works and the highest I've seen is 160
Hz. There's another one with 1/4 microsecond precision, but that's not
supported by every system and it's far more than I need. How do I get the 4
millisecond timing I'm after?
2. Lastly, how do I tell if a key is pressed or not. That is, if I press
the right arrow key, I expect the character to move right. I know how to
program the movement (and practically everything else in a 2D game like an
RPG), but I don't know how to tell if a key is pressed or not.
These are my requirements:
1. It must work with systems as old as Windows 95.
2. It must not use DirectX. If it is required for either of these, then
something that works with Windows 95. I strongly prefer going without
DirectX though.
I'm using Visual C++ 2005 Express if that helps.