Activities
Copy the Wallpaper folder.
Run the application program Wallpaper.
Use the project Wallpaper.mu and shell Wallpaper.cp to write your code.
Design your own scalable picture function.
You must draw your picture in terms of x, y, width, and height.
Write the body of the Wallpaper function.
Introduce variables width and height.
width = 400 / NumAcross; // window is 400 wide height = 400 / NumDown; // window is 400 highWrite a double for loop to fill the window with NumAcross by NumDown copies of your picture.
void House(int x, int y, int width, int height) { // Draws a house with lower left corner (x,y) // and given width and height int baseTop = y - 2*height/3; // top of the bottom of house, base of roof PaintRect(x, y, x + width +1, baseTop); // bottom of the house // the +1 makes roof fit better int midx = x + width/2; // halfway across the house DrawLine(x , baseTop, midx, y - height); // left side of roof DrawLine(x + width, baseTop, midx, y - height); // right side of roof }
Last Updated: October 3, 1997 10:11 pm by