📄 !bestlib.h
字号:
/*==========================================================================
*
* !BESTLIB.H 360 functions Friday, August 26, 1994
*
* Definitions for The BESTLibrary v2.31
* Designed for the Large memory model
*
* Authored independently by George Vanous
* Email any comments, compliments, or suggestions to vanous@helix.net
*
*==========================================================================*/
/* TABLE OF CONTENTS
------------------------
= FILE
INI FILE
= KEYBOARD
= LINKED LIST
= MATH
MATRIX
2D VECTORS
3D VECTORS
= MISCELLANEOUS
= MOUSE
= STRING
CHARACTER
CONVERSION
= TEXT MODE
ANIMATION
ATTRIBUTE
CHARACTER
CURSOR
GET
STRING
WINDOW
= VGA
VGA16
IMAGE
COMPRESS IMAGE
PIXEL IMAGE
PLANE IMAGE
VGA256
------------------------*/
#if !defined(__BESTLIB_DEF_)
#define __BESTLIB_DEF_
#include <stdio.h> /* necessary for "fil_count" and "fil_count_reg" */
/* ------------------------------------------------------------------------ */
/* --------------------------- COLOR CONSTANTS -------------------------- */
#define BLACK 0x0 /* 00 */
#define BLUE 0x1 /* 01 */
#define GREEN 0x2 /* 02 */
#define CYAN 0x3 /* 03 */
#define RED 0x4 /* 04 */
#define MAGENTA 0x5 /* 05 */
#define BROWN 0x6 /* 06 */
#define LIGHTGREY 0x7 /* 07 */
#define DARKGREY 0x8 /* 08 */
#define LIGHTBLUE 0x9 /* 09 */
#define LIGHTGREEN 0xA /* 10 */
#define LIGHTCYAN 0xB /* 11 */
#define LIGHTRED 0xC /* 12 */
#define LIGHTMAGENTA 0xD /* 13 */
#define YELLOW 0xE /* 14 */
#define WHITE 0xF /* 15 */
#define BLINKCHAR 0x8 /* value to add to background color for blinking */
/* ------------------------------------------------------------------------ */
/* -------------------------- NUMBER CONSTANTS -------------------------- */
#define ZERO 0x0 /* 00 */
#define ONE 0x1 /* 01 */
#define TWO 0x2 /* 02 */
#define THREE 0x3 /* 03 */
#define FOUR 0x4 /* 04 */
#define FIVE 0x5 /* 05 */
#define SIX 0x6 /* 06 */
#define SEVEN 0x7 /* 07 */
#define EIGHT 0x8 /* 08 */
#define NINE 0x9 /* 09 */
#define TEN 0xA /* 10 */
#define ELEVEN 0xB /* 11 */
#define TWELVE 0xC /* 12 */
#define THIRTEEN 0xD /* 13 */
#define FOURTEEN 0xE /* 14 */
#define FIFTEEN 0xF /* 15 */
#define SIXTEEN 0x10 /* 16 */
#define SEVENTEEN 0x11 /* 17 */
#define EIGHTEEN 0x12 /* 18 */
#define NINETEEN 0x13 /* 19 */
#define TWENTY 0x14 /* 20 */
#define PI 3.14159265358979323846 /* the venerable pi */
#define PIby2 1.57079632679489661923 /* pi / 2 (180 degrees) */
#define PIby4 0.785398163397448309616 /* pi / 4 ( 45 degrees) */
#define E 2.71828182845904523536 /* the venerable e */
#define SQRT2 1.41421356237309504880 /* sqrt(2) */
#define bySQRT2 0.707106781186547524401 /* 1 / sqrt(2) */
#define DtoR 0.017453292519943295769 /* convert degrees to radians */
#define RtoD 57.2957795130823208768 /* convert radians to degrees */
/* ------------------------------------------------------------------------ */
/* ---------------------- GENERAL-PURPOSE CONSTANTS --------------------- */
#define BYTE_MAX 255 /* maximum value taken on by type "byte" */
#define INT_MAX 32767 /* maximum value taken on by type "int" */
#define SHORTINT_MAX 127 /* maximum value taken on by type "shortint" */
#define WORD_MAX 65535L/* maximum value taken on by type "word" */
#define LONGU_MAX 4294967295 /* max value taken on by type "unsigned long" */
#define LONG_MAX 2147483647 /* maximum value taken on by type "long" */
#define CR '\r' /* carriage return character */
#define LF '\n' /* linefeed character */
#define NO -1 /* logical constant */
#define YES +1 /* logical constant */
#define NONE 0 /* logical constant */
#define OFF 0 /* logical constant */
#define ON +1 /* logical constant */
#define BOTH +2 /* logical constant */
#define UNMODIFY +2 /* logical constant */
#define FALSE 0 /* logical constant */
#define TRUE !(FALSE) /* logical constant */
#define BACKWARD -1 /* logical constant */
#define FORWARD +1 /* logical constant */
#define WARM 0x1234 /* warm boot identifier (like ctrl-alt-del) */
#define COLD 0 /* cold boot identifier (like pressing reset) */
#define MAX -1 /* logical constant */
#define MIN -2 /* logical constant */
#define MAXX 640 /* total screen x-length */
#define MAXXHALF 320 /* half screen x-length */
#define MAXMAXX 640 /* total (screen)+(virtual screen) x-length */
#define MAXMAXXHALF 320 /* half (screen)+(virtual screen) x-length */
#define MAXY 480 /* total screen y-height */
#define MAXYHALF 240 /* half screen y-height */
#define MAXMAXY 816 /* total (screen)+(virtual screen) y-height */
#define MAXMAXYHALF 408 /* half (screen)+(virtual screen) y-height */
#define WATCH_MAX 100 /* maximum number of stopwatches */
#define SIGNED -1 /* signed number */
#define UNSIGNED 1 /* unsigned number */
#define TCUR 255 /* text cursor */
#define MCUR 254 /* mouse cursor */
#define MEM 253 /* memory cursor
(coordinates are stored in memory) */
#define TEXTSAVE 0 /* store text video memory */
#define TEXTSHOW 1 /* restore text video memory */
#define TEXT 1 /* text mode */
#define TEXT25 3 /* 25-line text mode */
#define TEXT50 2 /* 50-line text mode */
#define TEXT25F -1 /* forced 25-line text mode */
#define TEXT50F -2 /* forced 50-line text mode */
#define VGA16 18 /* 640x480x16 graphics mode */
#define VGA256 19 /* 320x200x256 graphics mode */
#define TEXTPAGE1 0 /* text video page 1 */
#define TEXTPAGE2 1 /* text video page 2 */
#define TEXTPAGE3 2 /* text video page 3 */
#define TEXTPAGE4 3 /* text video page 4 */
#define TEXTPAGE5 4 /* text video page 5 */
#define TEXTPAGE6 5 /* text video page 6 */
#define TEXTPAGE7 6 /* text video page 7 */
#define TEXTPAGE8 7 /* text video page 8 */
#define TEXTPAGELAST 16 /* last video page: 4 for 50 line, 8 for 25 line */
#define TEXTPAGEACTIVE -1 /* current active text video page */
#define TEXTPAGEVISUAL -2 /* current visual text video page */
#define TEXTIMAGE_OVERHEAD 8 /* byte overhead in "textimagedata"ed objects */
#define TOP 1 /* top (same as up) */
#define UP 1 /* upward direction */
#define LEFT 2 /* leftward direction */
#define RIGHT 4 /* rightward direction */
#define DOWN 8 /* downward direction */
#define BOTTOM 8 /* bottom (same as down) */
#define ALIGN_NONE -1 /* perform no alignment when outputting text */
#define ALIGN_HORZ 0 /* horizontal center, shifting odd length left */
#define ALIGN_VERT 1 /* vertical center, shifting odd length up */
#define ALIGN_CENTER 2 /* horizontal and vertical center */
#define ALIGN_RIGHT 3 /* right justify text */
#define COPY_IMAGE 0x0003 /* hexadecimal code for performing a direct copy */
#define AND_IMAGE 0x0803 /* hexadecimal code for performing a logical AND */
#define OR_IMAGE 0x1003 /* hexadecimal code for performing a locical OR */
#define XOR_IMAGE 0x1803 /* hexadecimal code for doing an eXclusive OR */
#define COPY_IMAGE_SET 0x0013 /* perform a direct copy and set to scroll */
#define AND_IMAGE_SET 0x0813 /* perform a logical AND and set to scroll */
#define OR_IMAGE_SET 0x1013 /* perform a locical OR and set to scroll */
#define XOR_IMAGE_SET 0x1813 /* perform an eXclusive OR and set to scroll */
/* ------------------------------------------------------------------------ */
/* ------------------------ ASCII CODE CONSTANTS ------------------------ */
#define BACKSPACE 0x08 /* backspace keypress */
#define ESC 0x1B /* ESC keypress */
#define SPACE 0x20 /* */
#define QUOTE 0x22 /* " */
#define APOSTROPHE 0x27 /* ' */
#define HYPHEN 0x2D /* - */
#define BLOCK_SOLID 0xDB /*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -