Login Register


Simple HC text animation filter_list
Author
Message
Simple HC text animation #1
I was getting bored, so coded this extremely simple Animation in C.
The output:
[Image: ani.gif]

Compiler used: Turbo C++ [Yes, I still use this good old compiler apart from GCC]

The Source Code:

Code:
#include<graphics.h> #include<dos.h> #include<conio.h> #include<stdio.h> int main() { int i, gd = DETECT, gm; initgraph(&gd,&gm,"c:\\turboc3\\bgi"); //path to your bgi folder in double quotes settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(25,240,"Press any key to start rolling HC"); getch(); setviewport(0,0,639,440,1); for( i = 0 ; i <= 420 ; i = i + 10 ) { rectangle(40+i,250,70+i,400); //the 1st vertical line in H (|) rectangle(140+i,330,70+i,300); //the horizontal line in middle of H (-) rectangle(140+i,250,170+i,400); the last vertical line in H (|) ellipse(280+i,320,60,300,90,80); //for the outer part of C ellipse(280+i,320,60,300,70,60); //inner part of C setcolor(RED); delay(100); if( i == 420 ) break; clearviewport(); } getch(); closegraph(); return 0; }
[Image: MUJ8qSW.png]
-----------------------------------
Now learning:
Android Development, Java
Working on:
An FTP Client for Android
-----------------------------------

Reply

RE: Simple HC text animation #2
Why getch()? Also:
Code:
i = i + 10

Code:
i += 10

Cool simple little animation though..
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: Simple HC text animation #3
(06-29-2014, 09:20 AM)ArkPhaze Wrote: Why getch()?

To hold the screen even after the execution is complete. It accepts a keyboard input and then terminates the console window. Its really a headache for me in TC, if I don't use a getch() before the end of main(). Every time, I run the code, the console window does its job and disappears automatically. If its a small program, it will execute and terminate at the blink of an eye, without showing me the output. So, I use getch() while using TC.

Its like Hey Output window, do not disappear unless I order you to do so. Tongue
[Image: MUJ8qSW.png]
-----------------------------------
Now learning:
Android Development, Java
Working on:
An FTP Client for Android
-----------------------------------

Reply

RE: Simple HC text animation #4
I did not mention getch() because I didn't know what it did... I mentioned it because it's not standard. There are alternatives that are, however.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: Simple HC text animation #5
(06-29-2014, 12:24 PM)ArkPhaze Wrote: I did not mention getch() because I didn't know what it did... There are alternatives that are, however.

I know Smile The reputation says all. So, how do I overcome this? Any suggestions? and how do I complete the C? you can see that C is not bounded like H. I tried using another 2 lines but that would make it messy. Any simpleway out?
[Image: MUJ8qSW.png]
-----------------------------------
Now learning:
Android Development, Java
Working on:
An FTP Client for Android
-----------------------------------

Reply







Users browsing this thread: 1 Guest(s)