Sunday, 10 November 2013

TEXT ANIMATION WITH C

Hi friends in this program i am going to show you how to animate text using C,for this we have to use the header file <graphics.h>, and this is also an illustration of using different fonts in our C program ,hope you will enjoy it  ,I am  compiled it with using TURBO C++ 3.0

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
#include<dos.h>


int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int style, midx, midy;


   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Use any TURBO C++ compailer \n,windows 7 users install dosbox or do in safe mode ");

      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   midx = getmaxx() / 2;
   midy = getmaxy() / 2;

cleardevice();
        settextstyle(4,0,7);
        setbkcolor(2);
        setcolor(4); 
/* ANIMATING LOOP */
for(int k=0,p=0;(k<midx)&&(p<midy);k++,p++)
{
        delay(20);
        cleardevice();
outtextxy(k,p,"TRICKONICS.COM");
}
cleardevice();
        settextstyle(1,0,10);
setbkcolor(4);
        setcolor(2);
for(k,p;k>0,p>0;k--,p--)
       {outtextxy(p,k,"TRICKONICS");delay(20);
cleardevice();
}

cleardevice();  settextstyle(1,0,3);
outtextxy(midx-250,midy,"Thankyou visit our website www.trickonics.com"); 
         getch();
outtextxy(midx-250,midy+100,"devoloped by Muhammed roshan");

 getch();
   /* clean up */
   closegraph();
   return 0;
}

Read more from Source: TEXT ANIMATION WITH C - Trickonics.com http://www.trickonics.com/2013/11/text-animation-with-c.html#ixzz2kFVwuSKH
Follow and Like from Below Links
Follow : @Trickonics on Twitter | Trickonics on Facebook

No comments:

Post a Comment