Game Development Reference
In-Depth Information
/**
* Overload to initialize the game
*/
abstract protected void initialize();
abstract protected boolean gameOver();
abstract protected long getScore();
/**
* Canvas update task
*
* @author vsilva
*
*/
private class UpdateTask extends TimerTask {
@Override
public void run() {
updatePhysics();
/**
* Cause an invalidate to happen on a subsequent cycle
* through the event loop. Use this to invalidate the View
* from a non-UI thread. onDraw will be called sometime
* in the future.
*/
postInvalidate();
}
}
/**
* Halt game. Stops the update task. Called by a parent activity to halt
*
*/
public void halt() {
stopUpdateTimer();
}
/**
* Resume Game
*/
public void resume() {
initialize();
startUpdateTimer();
}
}
Any user-defined layout must define constructors with an Android Context and set of attributes for
being able to be processed properly by the system:
Search WWH ::




Custom Search