⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examp002.c

📁 supplementary source file 1 for The BESTLibrary
💻 C
字号:
/*==========================================================================
 *
 *  EXAMP002.C                                    Sunday, September 11, 1994
 *
 *  sample source code for The BESTLibrary, intended to give examples of:
 *    txt_fade_in
 *    txt_fade_out
 *    txt_fill_area
 *    txt_flood
 *    txt_print
 *    txt_set_act
 *    txt_set_vis
 *    txt_str_show
 *
 *  Authored independently by George Vanous
 *
 *==========================================================================*/


/* ------------------------------------------------------------------------ */
/* ----------------------------  INCLUDE FILES  --------------------------- */

#include <alloc.h>
#include <stdlib.h>
#include "!bestlib.h"                  /* include !BESTLIB.H in compilation */

/* ------------------------------------------------------------------------ */
/* ------------------------------  CONSTANTS  ----------------------------- */

#define BGCLR BLUE                              /* background color         */
#define TEXTHEIGHT 12                           /* y-height of printed text */
#define BUFFERSPACE 100                         /* byte size of "buffer"    */
#define PRINT(x, y, text) _16_boxfill(x, y+2, textwidth(text), TEXTHEIGHT-2, BLACK, COPY_IMAGE); outtextxy(x, y, text);

/* ------------------------------------------------------------------------ */
/* ------------------------------  MESSAGES  ------------------------------ */

#define ERR01 "\nI require 65,536 bytes (64kb) of free memory\nBut there is only %ld bytes currently available\n\nDo you want me to continue regardless [y/N] ? "
#define MSG01 "\n\nI suggest you try removing any unnecessary TSRs (Terminate but Stay Resident\nprograms) to increase the amount of available memory.\n\n"
#define DASHES printf("\n--------------------------------------------------------------------------------")

/* ------------------------------------------------------------------------ */
/* -------------------------  GLOBAL DEFINITIONS  ------------------------- */

/* The following three definition are required by TheBESTLibrary to be
   present, even if they are not all used.  If they are not present, the
   compiler will produce a "linker error". */
asciiscan key;                         /* global structure "key"            */
cursordata cursor;                     /* global structure "cursor"         */
mousedata msdata;                      /* global structure "msdata"         */

filldata fidata;                       /* global structure "fidata"         */
printdata prdata;                      /* global structure "prdata"         */

byte curx, cury,                       /* the cursor (x,y)                  */
     oldmode;                          /* old video mode                    */
char *buffer;                          /* general-purpose string buffer     */

/* ------------------------------------------------------------------------ */
/* -------------------------  FUNCTION PROTOTYPES  ------------------------ */

void begin_sequence(void);                      /* beginning sequence       */
void draw_menu(void);                           /* display main menu        */
void exit_sequence(void);                       /* exitting sequence        */
void mouse_demo(void);                          /* demonstrate mouse        */
void floodtext(char *text[]);                   /* part of "mouse_demo"     */
void showtext(char *text[]);                    /* part of "mouse_demo"     */
void string_demo(void);                         /* demonstrate strings      */
void text_animate(void);                        /* animates text            */
void text_fade(void);                           /* demonstrate text fading  */

void (*menuselect[])(void) = {                  /* pointer to functions     */
  text_fade, mouse_demo, string_demo, text_animate
};

/* ------------------------------------------------------------------------ */


/*----------------------------------------------------------------------------
 * MAIN SUBROUTINE OF EXAMPLE SOURCE CODE 002
 */
void main(void)
{
  int choice,                          /* user's menu choice                */
      count;

  begin_sequence();                    /* perform the beginning sequence    */
  draw_menu();
  txt_scroll_over(400);                /* scroll up the menu screen         */
  txt_set_act(TEXTPAGE1);              /* set first text page as active     */
  txt_set_vis(TEXTPAGEACTIVE);         /* show active text page             */
  txt_split(1023);                     /* restore screens to normal         */

  while (TRUE) {
    kbd_clear();                       /* clear keyboard buffer             */
    count = txt_get_num(25, 14, &choice, 1, '

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -