/******************************************************************************************** border.cpp Jim Millard for CO211/Fall 1999 Simple program that displays a blue/red checkerboard border around my name and email Uses the ezwin API ********************************************************************************************/ #include <iostream> #include <string> using namespace std; #include "ezwin.h" #include "rect.h" #include "label.h" int ApiMain() { const float winwidth=10., winheight=12.; const float height=2., //static height of all blocks width=2.; //static width of all blocks float column=1., //starting column for first block row=1.; //starting row for first block //create the primary window SimpleWindow W("Border, Name and Email", winwidth, winheight); W.Open(); //Draw the top border (5 blocks wide) RectangleShape R11(W,column,row,Blue,width,height); R11.Draw(); column += width; //move over one block width RectangleShape R21(W,column,row,Red,width,height); R21.Draw(); column += width; //move over one block width RectangleShape R31(W,column,row,Blue,width,height); R31.Draw(); column += width; //move over one block width RectangleShape R41(W,column,row,Red,width,height); R41.Draw(); column += width; //move over one block width RectangleShape R51(W,column,row,Blue,width,height); R51.Draw(); //Draw the right border (6 blocks down, but the corner is already drawn) row += height; //move down one block width RectangleShape R52(W,column,row,Red,width,height); R52.Draw(); row += height; //move down one block width RectangleShape R53(W,column,row,Blue,width,height); R53.Draw(); row += height; //move down one block width RectangleShape R54(W,column,row,Red,width,height); R54.Draw(); row += height; //move down one block width RectangleShape R55(W,column,row,Blue,width,height); R55.Draw(); row += height; //move down one block width RectangleShape R56(W,column,row,Red,width,height); R56.Draw(); //Draw the bottom border from right to left //(5 blocks over, but the corner is already drawn) column -= width; //move over one block width RectangleShape R46(W,column,row,Blue,width,height); R46.Draw(); column -= width; //move over one block width RectangleShape R36(W,column,row,Red,width,height); R36.Draw(); column -= width; //move over one block width RectangleShape R26(W,column,row,Blue,width,height); R26.Draw(); column -= width; //move over one block width RectangleShape R16(W,column,row,Red,width,height); R16.Draw(); //Draw the left border (6 blocks up, but the 2 corners are already drawn) row -= height; //move down one block width RectangleShape R15(W,column,row,Blue,width,height); R15.Draw(); row -= height; //move down one block width RectangleShape R14(W,column,row,Red,width,height); R14.Draw(); row -= height; //move down one block width RectangleShape R13(W,column,row,Blue,width,height); R13.Draw(); row -= height; //move down one block width RectangleShape R12(W,column,row,Red,width,height); R12.Draw(); //Draw the name and email in the center of the box Label name(W,winwidth/2,(winheight/2)-.25, "Jim Millard"); name.Draw(); Label email(W,winwidth/2,(winheight/2)+.25, "jim3@millard.org"); email.Draw(); //wait for input prior to quitting char ch; cout << "Enter a character to continue"; cin >> ch; Terminate(); return 0; }