LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-18-2005, 01:41 PM   #1
iriad
LQ Newbie
 
Registered: Nov 2005
Posts: 3

Rep: Reputation: 0
fps limiter: how?


i really need to make an fps limiter, but i just can't find any time function that will return the time in milliseconds. it's for windows and c++ (if that matters)... please help.

Last edited by iriad; 11-18-2005 at 04:37 PM.
 
Old 11-18-2005, 02:03 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
You are aware that this site is called.... linuxquestions.org ?

Eric
 
Old 11-18-2005, 02:08 PM   #3
iriad
LQ Newbie
 
Registered: Nov 2005
Posts: 3

Original Poster
Rep: Reputation: 0
well, a friend of mine said i could ask it here. besides, it's the non-*nix category...

i quote: "This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game."

Last edited by iriad; 11-18-2005 at 02:17 PM.
 
Old 11-18-2005, 04:27 PM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
For windows you might want to look at timeGetTime, which I believe is in winmm.lib and mmsystem.h. timeGetTime will give you the number of milliseconds since the machine was last rebooted. It wraps at something like 49 days, so depending on your application, you might want to keep that in mind.

For even more accurate timing, you can use a combination of QueryPerformanceCounter and QueryPerformanceFrequency.

And yes, it is ok to ask Windows questions here.

BTW, why do you need to limit FPS? If this is to slow down an animation for something like a 3D app, a better way is usually to base the animation on time rather than frame counts. This method allows faster computers to display smoother animation, and is how most games work. Trying to lock the animation to a fixed rate you could also potentially run into the problem of slower computers that can't keep up.

Last edited by deiussum; 11-18-2005 at 04:36 PM.
 
Old 11-18-2005, 04:36 PM   #5
iriad
LQ Newbie
 
Registered: Nov 2005
Posts: 3

Original Poster
Rep: Reputation: 0
thanks. i think that'll be good enough, i don't really expect the client of an mmorpg to be running for that long.
 
Old 11-18-2005, 04:40 PM   #6
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Quote:
Originally posted by iriad
thanks. i think that'll be good enough, i don't really expect the client of an mmorpg to be running for that long.
It doesn't wrap based on how long your client has been running, though. It is based on how long since Windows has started. So if you have someone who hasn't rebooted for 49 days (I know, not very likely with Windows, but I think I have come close to that a few times... ) you could have the timer wrap on you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bandwith limiter Derrick3 Linux - Newbie 4 09-17-2005 12:24 PM
Network Limiter? brownjag Linux - Software 2 06-12-2005 07:15 PM
bandwidth limiter Lleb_KCir Linux - Software 1 04-19-2005 10:07 PM
Slooow FPS (one fps) with WineX and THPS3 forrest44 Linux - Games 5 06-10-2004 09:12 AM
network limiter body00 Linux - Networking 6 05-10-2004 04:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration