I am attempting to replace a standard black background with a custom image, but am unsure as to how I might implement it…
Code (the onDraw method):
@Override
protected void onDraw(Canvas c) {
//c.drawARGB(255, 0, 0, 0);
if ( overlay.tick() )
if ( !todraw.tick() )
mintercept.endGame();
todraw.draw(c, Layer.BACKGROUND);
todraw.draw(c, Layer.CITIES);
todraw.draw(c, Layer.TRAILS);
todraw.draw(c, Layer.EXPLOSIONS);
todraw.draw(c, Layer.MISSILES);
todraw.draw(c, Layer.CHROME);
overlay.draw(c, Layer.CHROME);
}
public abstract void reset();
}
The commented line was responsible for the black background (or so I believe…); the blank space is reserved for my implementation of a custom background image. How might I do this?
The Canvas has a
drawBitmapmethod: fetch your image using aBitmapFactoryfrom a resource and draw it and you should be good to go.