Article explains how to use C++ graphics.h header file to create a stunning splash screen for your Turbo C projects.
This was mainly written for students those who learning C/C++ program and doing mini project with Turbo C / C++ compiler. The graphic class library called << graphics.h >> is used for creating this splash screen.
You need to make sure that the Turboc C complier with Graphics class librar "BGI" folder is installed.. Some Turboc installation dont have seperate BGI folder, but the library files will be completly copied to the TC directory..
To run this source code you need to make the linker options to use Graphics Library for compiling and linking..
Also you need to make sure that the graphics library path is added to the source code before running the code..
Need to specify the path of BGI graphics library folder location in the below initgraphics function..
Using the code
The splash window was created with rectangle and line function... The pop up window effect was created with the idea shown below...
The two lines drawn are reversed to make the window popup effect..
After this, the Logo was drawn with the help of putpixel,setfillstyle,fillellipse,bar,lineto,moveto,floodfill graphics functions.
Below is a basic explanation of above functions..
PutPixel : putpixel(int x, int y, int color);
putpixel function plots a pixel at location (x, y) of specified color.
Setfillstyle: setfillstyle( int pattern, int color);
Setfillstyle function sets the current fill pattern and fill color.
Fillellipse: fillellipse(int x, int y, int xradius, int yradius);
x and y are coordinates of center of the ellipse, xradius and yradius are x and y radius of ellipse respectively.
Bar : bar(int left, int top, int right, int bottom);
Bar function is used to draw a 2-dimensional, rectangular filled in bar . Coordinates of left top and right bottom corner are required to draw the bar. Left specifies the X-coordinate of top left corner, top specifies the Y-coordinate of top left corner, right specifies the X-coordinate of right bottom corner, bottom specifies the Y-coordinate of right bottom corner.
Moveto : moveto(int x, int y);
Moveto function changes the current position (CP) to (x, y)
Lineto : lineto(int x, int y);
lineto function draws a line from current position(CP) to the point(x,y), you can get current position using getx and gety function.
Draws a line from point (100,100) to point (200,200).
floodfill : void floodfill(int x, int y, int border);
Floodfill function is used to fill an enclosed area. To change fill pattern and fill color use setfillstyle.
The basic steps followed by the program is explained below..
The left side of the logo head and top part was completed and for loop was used to copy the left part of the face to right side. Below shows the code section before "For" loop.
The left side of the face was copied to the right side by for and while loop, then we will get a shape as shown below in the picture.
Later after drawing the face completly its the time to use the setfillstyle and floodfill function to create color with the closed section.
After filling the closed we will get a picture as shwon below...
After this splash screen you can clear graphics device and then draw the window or application you need.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.