(Print this page as a cover sheet for your printouts) LAB 5 - Graphics Section: CPSC 121-______________ Due: 11:59 P.M. Tuesday, April 12, 2011 "On my honor, as an Aggie, I have neither given nor received any unauthorized aid on any portion of the academic work included in this assignment." ________________________________ ________________________________ Typed or printed name of student Signature of student NOTE: Please follow your lab instructor's directions for submitting your assignment through CSNET. ONLY ASSIGNMENTS SUBMITTED TO CSNET WILL BE GRADED! Make a printout of each source file and staple it behind this cover sheet, unless your lab instructor directs otherwise. Sign it and give it to your TA in lab or put it in your TA's mailbox in the corner of the 3rd floor of HRBB, near room 312. IF YOU DO NOT TURN IN A SIGNED COVER SHEET YOUR WORK WILL NOT BE GRADED! NOTE: Homework will be graded on unix.cse.tamu.edu using g++. You are free to develop your programs on Visual C++ or any other platform, but it is your responsibility to make sure your programs also compile and execute correctly on unix.cse.tamu.edu using g++. The grade for this lab will be based on style (formatting, variable names, comments, etc.), syntax (no compilation or link errors), and correctness (passes all test cases). Your grade for this lab is: Problem # 1 2 3 4 Style /4 /4 /4 /2 Syntax /6 /6 /6 /3 Correctness /10 /10 /10 /5 ------------------------------------------------------------------- Total /20 /20 /20 /10 Grand total _____/60 1. (20 points) Write a C++/FLTK program that draws a checkerboard with pieces. The image at http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Draughts.svg/ 220px-Draughts.svg.png should serve as the basis for your program. For the checker pieces, make them white and red, with a black outline, as shown in the picture. For the board, you will need to create your own Color objects. Look up the RGB values for "moss green" and "cherry blossom pink"; use them for the background board like this: Color moss_green(fl_rgb_color(R,G,B)); Note that you cannot fill a Circle object due to a limitation in the provided code. To draw the pieces, you will need to draw a Circle with half the intended radius and an enlarged line. Also, do not forget the black outlines around the checker pieces. This program will be a first step for building your team project. Name your program hw5pr1.cpp. 2. (20 points) Exercise 3 on page 434 using FLTK. Note you must draw using lines, you MAY NOT use text. Name your program hw5pr2.cpp. 3. (20 points) Define a new graphic object Parallelogram with a constructor Parallelogram(Point tl, Point tr, Point bl) where tl is the top left point, tr is the top right point, and bl is the bottom left. Using those three points, you can determine where the fourth point goes. Your class should extend one of the existing classes. You must be able to set_fill_color and fill your parallelogram. Demonstrate your Parallelogram class by writing a program that draws three instances on the screen, filled in three different colors. Name your program hw5pr3.cpp. OPTIONAL EXTRA CREDIT ===================== 4. (10 points) Write a C++/FLTK program that draws a Chinese Checkers board (see image below). The board will be a six-pointed star with each point triangle of the board a different color. The board should have 3 sets of 15 parallel lines, set at 60 degree angles from one another, that subdivide it into equilateral triangles. Use the image at: http://www.boardgamesoftheworld.com/images/chinese-checkers-hop-ladder. gif as a guide (just draw the board, not the marbles and the hops). Each point triangle represents the color of a player, and each intersection of the parallel lines represents a valid space for a move in the game. Name your program hw5pr4.cpp.