|
-
Apr 27th, 2013, 06:44 AM
#1
Thread Starter
PowerPoster
i need some advices that i can't find easly:(
about frames count:
1 - i capture the actual time with GetTickCount() api function to TempStart.
2 - inside of game loop i count the frames;
3 - i capture the next time with GetTickCount() api function to TempEnd.
4 - i do TempEnd - TempStart and if is more and igual than 1000, i put the frames count to another variable and i reset the frame count.
is these pesudo-code correct?
-
Apr 27th, 2013, 07:06 PM
#2
Re: i need some advices that i can't find easly:(
Didn't I show you how before? Cause what I showed you before was exactly what you just said, so yes, thats correct.
-
Apr 28th, 2013, 05:45 AM
#3
Thread Starter
PowerPoster
Re: i need some advices that i can't find easly:(
 Originally Posted by Jacob Roman
Didn't I show you how before? Cause what I showed you before was exactly what you just said, so yes, thats correct. 
don't be mad... i must build my own code
i continue without understand 2 things:
1 - how avoid use very CPU?;
2 - how control the number of frames for not be very faster on other machine?
-
Apr 28th, 2013, 01:39 PM
#4
Re: i need some advices that i can't find easly:(
I wasn't mad, I was just saying you are correct. 
When it comes to making games, using the Do Loop or While loop will unfortunately lead to very high CPU usage. You can see this in majority of your major games for your PC. If you run them, you will see a lot of CPU usage being used. This is expected as the games are taking advantage of every aspect of your computer such as the video card, all the 3D graphics, the physics, the sound, and all the calculations that need done, etc etc. However the only way you can really really control your CPU usage is through C++ using various multithreading techniques. However its not really worth the hassle because A) Major games use a lot of CPU anyways, and B) A program using a lot of CPU isn't gonna affect your computer too much. Just as long as thats the only major game running. Otherwise you'll notice maybe a little lag. Noone really runs two major games at the same time anyways.
Now to answer your next question, theres 2 ways you can go about this. One is to use DirectX. DirectX handles the framerate for you automatically and goes with the monitors refresh rate. The other way I showed you using VB6 but can be converted to C++, and thats to lock the framerate at 60 frames per second. The function I created you can lock the framerate at any rate you want. But since most monitors run at 60 Hz. you should stick with 60 FPS.
-
Apr 28th, 2013, 01:54 PM
#5
Thread Starter
PowerPoster
Re: i need some advices that i can't find easly:(
 Originally Posted by Jacob Roman
I wasn't mad, I was just saying you are correct.
When it comes to making games, using the Do Loop or While loop will unfortunately lead to very high CPU usage. You can see this in majority of your major games for your PC. If you run them, you will see a lot of CPU usage being used. This is expected as the games are taking advantage of every aspect of your computer such as the video card, all the 3D graphics, the physics, the sound, and all the calculations that need done, etc etc. However the only way you can really really control your CPU usage is through C++ using various multithreading techniques. However its not really worth the hassle because A) Major games use a lot of CPU anyways, and B) A program using a lot of CPU isn't gonna affect your computer too much. Just as long as thats the only major game running. Otherwise you'll notice maybe a little lag. Noone really runs two major games at the same time anyways.
Now to answer your next question, theres 2 ways you can go about this. One is to use DirectX. DirectX handles the framerate for you automatically and goes with the monitors refresh rate. The other way I showed you using VB6 but can be converted to C++, and thats to lock the framerate at 60 frames per second. The function I created you can lock the framerate at any rate you want. But since most monitors run at 60 Hz. you should stick with 60 FPS.
can i test if any key was pressed by using GetAsyncKeyState()?
i build a nice function for these, but i get unpested results
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|