Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <unistd.h>
- const char *text = " --- === JESTEM PEDAŁEM === --- ";
- const int xmax = 80;
- const int ymax = 24;
- void goto_xy(int x, int y)
- {
- printf("\033[%d;%dH", y, x);
- }
- void set_colours(int a, int b)
- {
- a %= 8;
- b %= 8;
- printf("\033[%d;%dm", a+30, b+40);
- }
- void clrscr(int a, int b)
- {
- int i = ymax;
- set_colours(a,b);
- while(i--){
- goto_xy(0,i);
- int j=xmax;
- while(j--)
- putchar(' ');
- }
- }
- int main()
- {
- clrscr(5,6);
- int textlen = strlen(text);
- int n = xmax-textlen+1;
- while(1){
- int i;
- for(i=1; i<=n; ++i){
- goto_xy(i, ymax/2);
- printf("%s", text);
- fflush(stdout);
- usleep(80*1000);
- }
- for(i=n; i>=1; --i){
- goto_xy(i, ymax/2);
- printf("%s", text);
- fflush(stdout);
- usleep(80*1000);
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment