Topics:
Callback functions : idle, redisplay, mouse, keyboard, NULL
Double buffering
Menus : create menu, set menu, add entry, attach menu, add sub menu
Subwindows & multiple windows
Animating objects
Make the following modifications to Assignment 2:
Enable double buffering.
Create a main window with the "black & white" square
Place an ellipse in a SubWindow of the main window. Set the sub-window's display function to draw the background a different color.
Create a menu on the sub window only that allows the user to change the subwindow's background color.
Draw a circle and triangle, which have the same color, in a separate window entitled “window 2”. Allow the user to change the color of these objects by typing a key, 'r' - red, 'g' - green, 'b' - blue, 'y' - yellow, 'o' - orange, 'p' - purple, 'w' - white.
Animate the shapes using the idle function as follows:
Make the squares rotate counter clockwise.
Make the triangle rotate clockwise.
Make the circle increase in size and then decrease in size as though it was “breathing”.
Create a menu for the main window that is right-click activated with the following layout:
Stop Animation
Start Animation
Square Colors ->
White
Red
Green
Where each button does the indicated action.
(Extra Credit) Alter the main window so that if a user clicks on it with the left click button, a new "breathing" circle with a random color appears where s/he clicked.
Your program must print to the console what it does and how to use its interface. 2 points will be subtracted from the assignment's grade if this is not included.
Last modified February 11, 2016.