Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.requestFocus();
- long lastTime = System.nanoTime();
- double amountOfTicks = 60.0;
- double ns = 1000000000 / amountOfTicks;
- double delta = 0;
- long timer = System.currentTimeMillis();
- while(isRunning){
- long now = System.nanoTime();
- delta += (now - lastTime) / ns;
- lastTime = now;
- while(delta >= 1){
- tick();
- delta--;
- }
- if(isRunning)
- render();
- if(System.currentTimeMillis() - timer > 1000){
- timer += 1000;
- }
- }
- stop();
- }
- private void tick(){
- }
- private void render(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement