home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************/
- /* File Id. DEMO_B.C. */
- /* Author. Stan Milam. */
- /* Date Written. 21 Dec. 91. */
- /* */
- /* This program creates an advertisment for the C language us- */
- /* a window that moves around on the screen. */
- /* */
- /***************************************************************/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include "pcwproto.h"
-
- #define rnd(x) (rand() % (x))
- int demo_b (void) {
-
- WNDPTR *wnd;
- time_t timer;
- int tl, bl, wr, wc, lcv, ch;
- int mxr, mxc;
- static char *msg[] = {
- "Welcome to C",
- "The Powerful Language",
- "for",
- "Major Applications Software",
- NULL
- };
-
- /* Create a box with a advertisment for the C language */
-
- get_cursor_size(&tl,&bl);
- set_cursor_size(0,0);
- chk_video_state(&mxr,&mxc);
- bordercolor(YELLOW,BLUE);
- wnd = wframe(7,19,15,60,LIGHTGRAY,BLUE);
- q_block_write(9,CENTER,LIGHTGRAY,BLUE,msg);
- time(&timer); srand(timer); ch = keywait(3);
- for (lcv = 0; lcv < 10 && ch != 27; lcv++) {
- wr = rnd(mxr)+1; wc = rnd(mxc)+1;
- if ( mpresent ) hide_mouse();
- wndmove(wnd,wr,wc);
- if ( mpresent ) show_mouse();
- ch = keywait(3);
- }
- wpop(wnd); set_cursor_size(tl,bl);
- return 0;
- }
-
-