CS476/576

Assignment #2

Due Midnight, Wednesday Oct 27, 2010


Use Curses/Xlib/Motif  to implement the following program:

NAME

 drs  draw  random  shapes

 

SYNOPSIS

drs

 

DESCRIPTION
The program presents a Motif/Curses interfaces for drawing and displaying a set of simple random shapes (e.g., similar to the ones shown below). The interfaces has the following components:

 

·      Drawing Canvas: An nth click  at pixel position (x,y) on the Canvas draws a  shape that is randomly selected from a set of 10 different shapes. You may design these shapes as you like. Samples of these shapes are shown below.

The Curses interface displays the nth shape information with a label  n(x,y)r  at the curses position line x, column y and r is the order of the shape among the set of ten shapes (1, 2 , 3 ..10).  

Assume that:

ü the Canvas dimension is (width=800 x height=600 pixels).

ü the Curses interface dimension is  (80 columns x  20 lines).

A click at the center of an existing shape deletes the shape from the Canvas and erases the corresponding vertex label information from the Curses interface. You may draw a small circle around the center of the shape so that a click inside this circle deletes the shape.

·      Clear Button:  Clears the Canvas and the Curses interface.

·      Display All Shapes Button:  Clears the Canvas and the Curses interface and draws the 10 shapes at the top of the Canvas.

·      Exit Button: Exits the programs with the choice to confirm/cancel.

 

A sample implementation is under: /home/cs476/public_html/fall10/assignments/a2/wahab/drs

The 10 shapes of this program are:

 

             1              2               3               4             5

 

 

TenShapes.JPG

 

              6              7             8               9             10