Showing posts with label special effect. Show all posts
Showing posts with label special effect. Show all posts
Tuesday, November 19
Easy Colouring
As promissed here is bit easy technique for those colour commands;
Hope you guys understand it :
Theme here is to use funcitons to determin command stuff i.e. how much easy would it be if you only have to type
color(r); //red colour
here is the function that will help you to use colours easily
______________________________________________________________________
- HANDLE Output=GetStdHandle(STD_OUTPUT_HANDLE);
- void colour(int x)
- {SetTextAttribute(Output,x);}
______________________________________________________________________
here if you remember colour codes integers just use them as follows:
colour(10); //green
and if you want to make it runing upon character values you can place switch in it
- HANDLE Output=GetStdHandle(STD_OUTPUT_HANDLE);
- void colour(char ch)
- {
- int x;
- switch (ch)
- {
- case 'r': x=12; break; //red
- case 'b': x=9; break; //blue
- case 'g': x=10; break; //green
- case 'a': x=11; break; //aqua
- case 'v': x=13; break; //voilet
- case 'y': x=14; break; //yellow
- case 'w: x=15; break; //white
- }
- SetTextAttribute(Output,x);
- }
now you can call it as this;
colour('r'); //red colour
end of post;
Sunday, November 17
Loading bar in C++
Since we are high on special effects these days, so below is the code to make a loading bar in C++.
Output is :
#include iostream.h
#include conio.h
#include windows.h
#include dos.h
void main()
{
system("color 0a");
cout<<"\n\n\n\t\t\t\tPlease wait while loading\n\n";
char a=177, b=219;
cout<<"\t\t\t\t";
for (int i=0;i<=15;i++)
cout<<a;
cout<<"\r";
cout<<"\t\t\t\t";
for (int i=0;i<=15;i++)
{
cout<<b;
for (int j=0;j<=1e8;j++); //You can also use sleep function instead of for loop
}
clrscr();
cout<<"\n\n\n\t\t\tHELLO WORLD\n\n\t\t\tShashka made by Ivan :P";
getch();
}
Output is :











