/* Module : KMVID.H Author : Kim Moser Date : 4/5/89 System : IBM PC / Borland Turbo-C 2.0 Descrip: My video routines */ #include /* Colors */ #define maxrow() 25 /* Width and height of screen (in characters); may be changed if video card supports more rows and/or columns */ extern int vidmode(void); extern int vidcol(void); extern int vidrow(void); /* /* Color definitions [assumed to be unsigned short integers] */ #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LIGHTGREY 7 #define DARKGREY 8 #define LIGHTBLUE 9 #define LIGHTGREEN 10 #define LIGHTCYAN 11 #define LIGHTRED 12 #define LIGHTMAGENTA 13 #define YELLOW 14 #define BRIGHTWHITE 15 */ #define BLINKING 8 /* Adding this to a background which is [0..7] will cause foreground to blink */ /* PC ASCII characters: vertical and horizontal bars: */ #define HORIZ_LINE 196 #define VERT_LINE 179 /* This is what gets added to extended keystrokes to differentiate them from 'normal' keystrokes: */ #define EXTENDED 256 /* Ordinal keystroke values: */ #define ESCKEY 27 #define ENTERKEY 13 #define BACKSPACEKEY 8 #define ALT_G_KEY (34+EXTENDED) #define ALT_V_KEY (47+EXTENDED) #define DELETEKEY (83+EXTENDED) #define UPKEY (72+EXTENDED) #define DOWNKEY (80+EXTENDED) #define LEFTKEY (75+EXTENDED) #define RIGHTKEY (77+EXTENDED) #define CTRL_LEFTKEY (115+EXTENDED) #define CTRL_RIGHTKEY (116+EXTENDED) #define HOMEKEY (71+EXTENDED) #define ENDKEY (79+EXTENDED) #define PGUPKEY (73+EXTENDED) #define PGDNKEY (81+EXTENDED) #define CTRL_PGUPKEY (132+EXTENDED) #define CTRL_PGDNKEY (118+EXTENDED) #define F1KEY (59+EXTENDED) #define F2KEY (60+EXTENDED) #define F3KEY (61+EXTENDED) #define F4KEY (62+EXTENDED) #define F5KEY (63+EXTENDED) #define F6KEY (64+EXTENDED) #define F7KEY (65+EXTENDED) #define F8KEY (66+EXTENDED) #define F9KEY (67+EXTENDED) #define F10KEY (68+EXTENDED) #define SH_F1KEY (84+EXTENDED) #define SH_F2KEY (85+EXTENDED) #define SH_F3KEY (86+EXTENDED) #define SH_F4KEY (87+EXTENDED) #define SH_F8KEY (91+EXTENDED) #define CTRL_F1KEY (94+EXTENDED) #define CTRL_F2KEY (95+EXTENDED) #define CTRL_F3KEY (96+EXTENDED) #define CTRL_F4KEY (97+EXTENDED) #define CTRL_F5KEY (98+EXTENDED) #define ALT_F1KEY (104+EXTENDED) #define ALT_F2KEY (105+EXTENDED) #define ALT_F3KEY (106+EXTENDED) #define ALT_F4KEY (107+EXTENDED) #define ALT_F5KEY (108+EXTENDED) extern int shift(void); /* Returns TRUE if either [or both] SHIFT key(s) are down, else FALSE */ extern char *inttostr( long int x, unsigned short int w, char *s ); /* Assumes 1 <= w <= 9 */ /*** VIDEO ROUTINES ***/ extern void set_color( int f, int b ); extern void writeat( int x, int y, char *s ); extern void writeatcenter( int y, char *s ); extern void writeatch( int x, int y, char c ); /* Write character 'c' at screen location 'x','y' (1,1 = top left). Note: c must be passed as 'c', NOT "c", because it is a char. */ extern void fillarea( int x1, int y1, int x2, int y2, int f, int b, char c ); /* Fills area of screen bounded by (x1,y1) and (x2,y2) [offset from (1,1)] with char 'c' using foreground and background colors 'f' and 'b' */ extern void clearscr( int f, int b ); extern void pushscrn(void); /* Saves text screen in buffer. Calls are NOT stacked; popscrn() must be called before next call to pushscrn() or previous screen will be lost and its memory will be 'leaked'. */ extern void freescrn(void); /* Disposes of SCRNBUF */ extern void popscrn(void); static char *SINGLEBOX="\332\304\277\263\263\300\304\331"; extern void box( int x1, int y1, int x2, int y2, char *s ); /* Draws a box bounded by x1,y1,x2,y2, as follows: s[0] s[1] ... s[1] s[2] s[3] s[4] . . . . s[3] s[4] s[5] s[6] ... s[6] s[7] */ extern int lotus( int x, int y, int f1, int b1, int f2, int b2, int h_v, char *s ); extern char peekvid( int x, int y ); extern void peekcolor( int x, int y, int *f, int *b ); /*** KEYBOARD ROUTINES ***/ extern int keyhit(void); /*** INITIALIZATION ***/ extern void initkmvid(void);