home *** CD-ROM | disk | FTP | other *** search
- #include <jaz.h>
- #include <keys.h>
- #include <jzscreen.h>
- #include <gscreen.h>
-
- char *wtext1[] = {
- "Welcome to the JazSoft \"C\" Library",
- "This demo illustrates the use of some",
- "of the screen and window routines.",
- "If you are interested in obtaining",
- "Source code and the libraries to over",
- "125 functions, Contact:",
- "JazSoft Software (Jack A. Zucker)",
- "301-794-5950 301-794-8763 CIS:75766,1336",
- "Press any key to continue...",
- ""
- };
-
- char *wtext2[] = {
- "The first example shows how to overlay",
- "a window with another one. The first window",
- "is still there. It's just hiding underneath",
- "the second one!",
- "Here, I'll show you...",
- ""
- };
-
- char *wtext3[] = {
- "The second example shows",
- "how to move a window to",
- "another part of the screen",
- "Use the arrow keys and then",
- "Press <Enter> when done.",
- ""
- };
-
- char *wtext4[] = {
- "We can even change",
- "the color of the window.",
- "It's as easy as:",
- ""
- };
-
- char *wnum[] = {
- "ONE...",
- "TWO...",
- "THREE...",
- ""
- };
-
- main()
- {
- TWINDOW *wptr[10]; /* pointer to window structure */
- TWINDOW *originalscreen;
- int w,wrow,wcol;
- int wch,wscan;
-
- originalscreen = jzappend(&g_header,0,0,0,25,80,0xff);
-
- #if ! DEBUG
- jzlogo();
- #endif
-
- jzclswnd(0xff);
-
- wptr[0] = jzopnwnd(0,5,25,45,11,WHITE,BLUE);
-
- showtext(wtext1);
-
- wptr[1] = jzcpywnd(wptr[0],1);
-
- getch();
-
- wptr[2] = jzopnwnd(2,10,32,45,7,BLACK,RED);
-
- showtext(wtext2);
-
- wptr[3] = jzcpywnd(wptr[2],3);
-
- for (w = 0 ; w < 5 ; w ++) {
- if (w & 1) jzrstwnd(wptr[1]);
- else jzrstwnd(wptr[3]);
- jzdelay(18L);
- }
-
- wptr[4] = jzopnwnd(4,12,40,30,7,BLUE,CYAN);
-
- showtext(wtext3);
-
- wptr[5] = jzcpywnd(wptr[4],5);
-
- wcol = 40; /* init column */
- wrow = 12; /* init row */
-
- do {
- if (wch = jzinkey(&wscan)) { /* not a special char */
- if (wch == 13) break; /* exit loop on enter key */
- }
- else
- switch (wscan) {
- case UARR : if (wrow > 0) {
- wrow --;
- jzrstwnd(wptr[4]); /* restore previous window */
- wptr[4]->row1--;
- wptr[4]->row2--;
- jzsavwnd(wptr[4]);
- jzmovwnd(wptr[5],wrow,wcol);
- }
- break;
- case DARR : if (wrow < 17) {
- wrow ++;
- jzrstwnd(wptr[4]); /* restore previous window */
- wptr[4]->row1++;
- wptr[4]->row2++;
- jzsavwnd(wptr[4]);
- jzmovwnd(wptr[5],wrow,wcol);
- }
- break;
- case LARR : if (wcol > 0) {
- wcol --;
- jzrstwnd(wptr[4]); /* restore previous window */
- wptr[4]->col1--;
- wptr[4]->col2--;
- jzsavwnd(wptr[4]);
- jzmovwnd(wptr[5],wrow,wcol);
- }
- break;
- case RARR : if (wcol < 50) {
- wcol ++;
- jzrstwnd(wptr[4]); /* restore previous window */
- wptr[4]->col1++;
- wptr[4]->col2++;
- jzsavwnd(wptr[4]);
- jzmovwnd(wptr[5],wrow,wcol);
- }
- break;
- }
- } while (-1);
-
- wptr[6] = jzopnwnd(6,0,0,26,8,BLACK,MAGENTA);
-
- showtext(wtext4);
-
- wptr[7] = jzcpywnd(wptr[6],7);
-
-
- for (w = 0; *wnum[w] ; w ++) {
- locate(w+3,0);
- wprintf(wnum[w]);
- jzclrwnd(wptr[7],(w << 5) + 1);
- jzdelay(18L);
- }
-
- for (w = 6 ; w >= 0 ; w -= 2) {
- jzdelay(18L);
- jzclswnd(w);
- }
-
- jzloccur(23,0);
-
- }
-
- showtext(fstr)
- char **fstr;
- {
- int w;
-
- for (w = 0 ; *fstr[w] ; w ++) {
- locate(w,0);
- clickwrite(fstr[w]);
- }
- }
-
- clickwrite(fstr)
- char *fstr;
- {
-
- while (*fstr) {
- wprintf("%c",*fstr++);
- #if ! DEBUG
- soundon(20000);
- jzdelay(1L);
- soundoff();
- #endif
- }
- }
-
-