can me, how can calculate , show fps in animation? want show simple rect (for example). if have code: private final fps = 30; private final size = 10; private int x = 10; private int y = 0; private string myfps; private void start(){ while(true){ moverect(); paint(); } } private void paint(){ g2.drawrect(x, y, size, size); g2.drawstring(myfps, 10, 10); } private void moverect(){ x++; } here copypaste of old simple java graphics+bufferstrategy gameloop test app. animation loop draws few moving rectangles , fps counter. java -cp ./lib/test.jar gameloop2 "fullscreen=false" "fps=60" "vsync=true" //http://www.javagaming.org/index.php/topic,19971.0.html //http://fivedots.coe.psu.ac.th/~ad/jg/ch1/ch1.pdf import java.util.*; import java.awt.color; import java.awt.frame; import java.awt.graphics; import java.awt.graphicsconfiguration; import java.awt.graphicsdevice; import java.awt.graphicsenvironmen...
Comments
Post a Comment