November 2011
Beginner
196 pages
5h 3m
English
Now that you have lots of great features like your user interface controls and boats, you need to add them to the screen. To do so, the onDraw() function needs an adjustment. Listing 9-11 contains the entire code for the function.
Ensure that your onDraw function looks exactly like Listing 9-11 or the images will not be drawn to the screen.
Listing 9-11. onDraw()
@Override
public void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLUE);
ground.draw(canvas);
//the user controls
dock.draw(canvas);
marker.draw(canvas);
trash.draw(canvas);
cannonleftsmall.draw(canvas);
cannonrightsmall.draw(canvas);
cannondownsmall.draw(canvas); cannonupsmall.draw(canvas); ...Read now
Unlock full access