This function is used to draw a solid single line around the current viewport. This function takes no argument and returns nothing. Draw a solid single line around the current viewport using color
saygoodbye() This function is created to give a closing screen to the user before leaving. This function takes no argument and returns nothing. Define structure to read viewport Read viewport settings Display the message of winning game with proper format. Clear the graphics screen Return to main function
initialize() This function is created to initialize the graphics systems. This function takes no argument and returns nothing. Initialize graph If error occurs during initialization of graph display proper message Read palette from board Read maximum number of colors Read hardware aspect Calculate aspect ratio Return to main function
bell() This function is created to play different types of music. This function takes integer value as argument and returns nothing. The music will be played according to the argument passed. Set the frequency of note Using switch case, play sound of different frequency for different interval of time according to the argument Close the sound Return to the main function
delbrick() This function is created to erase the brick which is knocked by the ball. This function also doesn’t take argument and return nothing. Set the color of rectangle Erase the color if the ball reaches the coordinate of the brick Set background color in the place of erased brick Return to the main function
bricks() This function is created to draw bricks at upper layer of screen. There are 4 layers with 20 rows. This function doesn’t take any argument and returns nothing. Draw the brick at appropriate coordinates using for loops for rows and columns Return to main function
screen() Screen() function is created to display the instructions for playing game, options play or exit and to select the level of the program. This also doesn’t take any argument and returns nothing. initialize graph draw a rectangle covering the display screen set background color display instructions for playing the game with musical sound clear buffer close graph initiate graph Set background color Display options p for play e for exit
mainscreen() Mainscreen() function is created to display the welcome screen at the initial position. This function takes no argument and returns nothing. The algorithm for this function is: Initialize graph Draw a rectangle covering the display screen Set background color ex RED, BLUE etc. Display the welcome information on screen at different positions with music in background. Clear buffer Close graph Return to main functions.
Steps followed to code the program First the concept of simple graphic program was built up and for which Brick game is the simplest for coding. The simple diagrams of program were constructed and raw codes were collected and written. Different functions were created to do individual task. The module was coded and the user defined functions were included in the module. The errors were debugged and the program was launched in Turbo C environment.