home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * sc_test1.c - screen functions test program.
- *
- * Purpose: This file contains functions to test the the screen
- * functions. See also sc_test2.c
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include "blackstr.h"
- #include "sc_head.h"
-
- void main()
- {
- int i, j;
-
- kb_init(NULL,NULL,NULL);
- sc_init(MO_CO80,BLUE,WHITE); /* init screen to: Color */
- /* 80x25 */
- sc_setcur(0,0); sc_eeol();
- sc_setcur(28,0);
- sc_puts("Hello from screen test 1\n\r");
-
- sc_setcur(0,2); sc_eeol();
- sc_setcur(0,3); sc_eeol();
- sc_setcur(0,4); sc_eeol();
- sc_setcur(0,5); sc_eeol();
- sc_setcur(0,2);
- sc_puts("Phase 1 - Functions tested: sc_init(), sc_setcur(), sc_eeol(), sc_puts()\n\r");
- sc_puts(" printf(), kb_getch()\n\r");
- sc_puts(" Externals tested: sc_col_, sc_row_\n\r");
- sc_puts(" Foreground = blue, background = white\n\r");
-
- sc_setcur(10,7);
- sc_puts("Cursor should now be at column = 10, row = 7");
- sc_setcur(10,8);
- printf("Test of printf - attributes return to black & white");
- sc_setcur(10,9);
- printf(" Numbers: %d %d %d",2,4,6,8);
- sc_setcur(10,10);
- printf(" String: %s", "Test string");
- sc_setcur(10,11);
- printf("Cursor is at column = %d, row = %d",sc_col_,sc_row_);
-
- sc_setcur(0,15);
- sc_puts("Press any key to continue...");
- kb_getc();
-
- sc_clr();
- sc_color(WHITE,BLUE);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,1); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 2 - Functions tested: sc_clr(), sc_color(), sc_box(), sc_windo()\n\r");
- sc_puts(" Foreground = white, background = blue\n\r");
-
- sc_box(29,4,61,16);
- sc_windo(30,5,60,15);
- sc_setcur(0,0);
- sc_puts("Now is the time for all good men to see ");
- sc_puts("if the window wrap feature will work.");
-
- sc_setcur(0,15);
- sc_puts("Press any key to continue...");
- kb_getc();
-
- sc_windo(0,0,sc_cols_-1,sc_rows_-1);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,1); sc_eeol();
- sc_setcur(0,2); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 3 - Functions tested: sc_attr(AT_REG), sc_attr(AT_INV), sc_attr(AT_BLINK)\n\r");
- sc_puts(" sc_scroll(), sc_clrwin()\n\r");
- sc_puts(" Foreground = red, background = green\n\r");
-
- sc_color(RED,GREEN);
- sc_windo(30,5,60,15);
- sc_clrwin(30,5,60,15);
- sc_setcur(0,0);
- sc_puts("\n\rNow is the time for all good men to see regular");
- sc_attr(AT_INV);
- sc_puts("\n\rNow is the time for all good men to see inverse");
- sc_attr(AT_BLINK);
- sc_puts("\n\rNow is the time for all good men to see blinking or EGA color");
- sc_attr(AT_REG);
- sc_setcur(0,15);
- sc_puts("Press any key to scroll up 1");
- kb_getc();
- sc_scroll(-1,30,5,60,14);
- sc_setcur(0,15); sc_eeol();
- sc_puts("Press any key to scroll down 2");
- kb_getc();
- sc_scroll(2,30,5,60,14);
-
- sc_setcur(0,15); sc_eeol();
- sc_puts("Press any key to continue...");
- kb_getc();
-
- sc_windo(0,0,sc_cols_-1,sc_rows_-1);
- sc_clr();
- sc_color(WHITE,BLUE);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 4 - Draw bars of different colors\n\r");
-
- sc_windo(20,3,60,22);
- sc_setcur(0,0);
- for(i=0;i<16; ++i) {
- sc_setcur(0,i+3);
- sc_color(i,i);
- sc_eeol();
- }
-
- sc_color(WHITE,BLUE);
- sc_setcur(0,22); sc_eeol();
- sc_puts("Press any key to continue...");
- kb_getc();
-
- sc_windo(0,0,sc_cols_-1,sc_rows_-1);
- sc_clr();
- sc_color(BLUE,YELLOW);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,1); sc_eeol();
- sc_setcur(0,2); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 5 - Functions tested: sc_getcol(), sc_getrow()\n\r");
- sc_puts(" External tested: wrapf_\n\r");
- sc_puts(" Foreground = blue, background = yellow\n\r");
- sc_box(24,4,51,13);
- sc_windo(25,5,50,12);
- wrapf_ = FALSE;
- sc_setcur(0,7);
- sc_puts("The wrap flag is now off and the characters will overwrite in last column");
-
- sc_windo(0,0,sc_cols_-1,sc_rows_-1);
- sc_setcur(5,20);
- i = sc_getcol();
- j = sc_getrow();
- printf("Cursor moved to col = 5, row = 20 - sc_getcur() = %d sc_getrow() = %d",i,j);
-
- sc_color(WHITE,BLUE);
- sc_setcur(0,22); sc_eeol();
- sc_puts("END OF TEST - Press any key to exit...");
- kb_getc();
- sc_color(WHITE,BLACK);
- sc_clr();
- }
-