Skip to content

Instantly share code, notes, and snippets.

@ThuCommix
Created May 21, 2014 13:14
Show Gist options
  • Save ThuCommix/20f2b376c303bf2829b6 to your computer and use it in GitHub Desktop.
Save ThuCommix/20f2b376c303bf2829b6 to your computer and use it in GitHub Desktop.
package com.game;
public class Gameloop
extends Thread
{
public long Wait;
public Game Game;
private boolean run;
public Gameloop(Game g, long Wait)
{
this.Game = g;
this.Wait = Wait;
}
public void GameStop()
{
this.run = false;
}
public void run()
{
this.run = true;
while (this.run) {
try
{
sleep(this.Wait);
this.Game.update();
this.Game.invalidate();
this.Game.repaint();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment