Game Development Reference
In-Depth Information
* Base class for all games. Extends {@link LinearLayout} and uses a
* {@link TimerTask} to invalidate the view
*
* @author V. Silva
*
*/
public abstract class ArcadeGame extends LinearLayout {
// App context
private Context mContex;
// Update timer used to invalidate the view
private Timer mUpdateTimer;
// Timer period
private long mPeriod = 1000;
/**
* C
*
* @param context
*/
public ArcadeGame(Context context) {
super(context);
mContex = context;
}
public ArcadeGame(Context context, AttributeSet attrs) {
super(context, attrs);
mContex = context;
}
/**
* Fires on layout
*/
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
try {
// Init game
initialize();
/**
* start update task. Which will fire onDraw in the future
*/
startUpdateTimer();
} catch (Exception e) {
// bug
e.printStackTrace();
}
}
/**
Search WWH ::




Custom Search