develop your own mobile games from java

  Game loop of HardDriveCanvas.java
public void start()
{
gameRunning = true;
Thread gameThread = new Thread(this);
gameThread.start();
}
... ... ... ...
... ... ... ...
public void run()
{
Graphics g = getGraphics();
//... ... ...some code
while (gameRunning) //The game loop
{
tick();
input();
render(g);

//... ... ...some code

try
{
Thread.sleep(timeStep );
//... ... ... ...some code
}
catch (InterruptedException ie) { stop(); }

}

Posted in |