Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] how do you make an fps counter in java?

Started by davenirline Nov 19, 2004 at 12:29 AM 3 replies 4.8k views
Original Post
davenirline
davenirline
how? does anyone know?
Sijmen
Sijmen
int frames;float seconds;...frames++int fps = (int)(frames/seconds);


Why not do it like this?
smitty1276
smitty1276
If you use LWJGL, it has a nice high-precision timer included.

LWJGL is just a bunch of wrappers for OpenGL, OpenAL, FMod, and some input and utility classes. It handles keyboard, mouse, joystick, etc., and includes classes for handling vectors and things like that. I think they recently even added a class to load models (from XML unfortuntely, and I'm not even sure its fully implemented yet).

www.lwjgl.org
davenirline
davenirline
it's for my j2me project. ok...

int fps = frame / seconds;

where would you get seconds? i think that the time must be independent from the overall program control. the time must be out of the app itself. so where do i get the independent time?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.