I have a resizable LWJGL display, it works fine, just that the timing doesn’t calculate that there was a long delay between the frame were I wasn’t resizing, and the frame that I was resizing (Current).
So delta (Time in ms between frames), freaks out and thinks my computer lagged.
Were I’m using deta:
sunX += 0.3f * delta;
My timing class:
package passage.games.pdday.handling;
import org.lwjgl.Sys;
public class TimingHandler {
private long lastFrame;
private float fps;
private float frame;
private long lastFPS;
public void init(){
getDelta();
lastFPS = getTime();
}
public void tick(int delta){
updateFPS();
}
public int getDelta() {
long time = getTime();
int delta = (int) (time - lastFrame);
lastFrame = time;
return delta;
}
public long getTime() {
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
public void updateFPS() {
if (getTime() - lastFPS > 1000) {
fps = frame;
frame = 0;
lastFPS += 1000;
}
frame++;
}
public float getFps() {
return fps;
}
}
while(!Display.isCloseRequested()){
int delta = timingObj.getDelta();
render();
tick(delta);
}