Frooster

Paint in C++ v1.0

Nov 9th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.56 KB | None | 0 0
  1. #include "head.h"
  2. int menu()
  3. {
  4.  int color;
  5.  cout<<"\t\t<<<<<----------Paint Program in C++---------->>>>>"<<endl;
  6.  cout<<"\t<<<<<----------Done by Frooster and Ram Narayan---------->>>>>";
  7.  cout<<"\nSelect color of brush:"<<endl;
  8.  cout<<"1.Dark Blue\n2.Green\n3.Light Blue\n4.Red\n5.Pink\n6.Orange\n7.White\n8.Grey\n9.Purple\n10.Lime Green"<<endl;
  9.  cout<<"Your Choice:";
  10.  cin>>color;
  11.  clrscr();
  12.  gotoxy(35,6);
  13.  cout<<"Instructions";
  14.  gotoxy(10,7);
  15.  cout<<"1.Wait for 5 secs for brush to load";
  16.  gotoxy(10,8);
  17.  cout<<"2.Press Arrow Keys to move brush...Next version will try";
  18.  gotoxy(12,9);
  19.  cout<<"to implement Mouse :P";
  20.  gotoxy(10,10);
  21.  cout<<"3.Press Arrow key once to move in the corresponding direction and";
  22.  gotoxy(12,11);
  23.  cout<<"tap once and hold key to continously move in one direction";
  24.  gotoxy(10,12);
  25.  cout<<"4.Tap two arrow keys simultaneously to move in a cross.Cannot";
  26.  gotoxy(12,13);
  27.  cout<<"hold two arrow keys to move continously...";
  28.  gotoxy(35,14);
  29.  cout<<"Good Luck....";
  30.  return color;
  31. }
  32. void main()
  33. {
  34.  int ch,i=100,j=250,color;
  35.  color=menu();
  36.  getch();
  37.  clrscr();
  38.  int gd=DETECT,gm;
  39.  initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
  40.  while(ch!=27)
  41.  {
  42.   int x=0,y=0;
  43.   setcolor(color);
  44.   circle(i,j,10);
  45.   if(kbhit())
  46.   {
  47.    ch=getch();
  48.    if(ch==72)//Down Arrow
  49.    {
  50.     x=0;
  51.     y=-1;
  52.    }
  53.    if(ch==80)//Up Arrow
  54.    {
  55.     x=0;
  56.     y=+1;
  57.    }
  58.    if(ch==77)//Right Arrow
  59.    {
  60.     x=+1;
  61.     y=0;
  62.    }
  63.    if(ch==75)//Left Arrow
  64.    {
  65.     x=-1;
  66.     y=0;
  67.    }
  68.   }
  69.   i=i+x;
  70.   j=j+y;
  71.   delay(1);
  72.  }
  73.  closegraph();
  74. }
Advertisement
Add Comment
Please, Sign In to add comment