// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
// º NPSGUI.LIB º
// º Copyright 93-94, Nearly Perfect Software. Ç¿
// º All Rights Reserved º³
// º þ Written by Brad Broerman º³
// º þ Last Modified: 04/08/94 º³
// º þ Revision 2.5 º³
// ÈÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ³
// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
#ifndef NPSGUIH
#define NPSGUIH
#include <graphics.h>
#include <iostream.h>
// These two are for the button mode.
#define TEXT 0
#define IMAGE 1
// These two are for the panels InOrOut.
#define IN 0
#define OUT 1
// These are for the mouses buttons in btnpressed.
#define LEFT_BTN 1
#define RIGHT_BTN 2
#define CENTR_BTN 4
// These are for the screen resolution.
#define LO_RES 0
#define MED_RES 1
#define HI_RES 2
// These are for the line thickness in checkbox.setline().
#define THICK 3
#define THIN 1
// These are for the predefined mouse cursor shapes.
#define ARROW 1
#define UPARROW 2
#define LEFTAROW 3
#define CHECK 4
#define HAND 5
#define HOURGLASS 6
// This is an RGB pallete entry. It's used in the graphic classes.
typedef struct
{
unsigned char r,g,b;
} RGBPAL;
class screen
{
// This is the class for initializing the screen in graphics mode.
// The Init function, or the constructor will initialize the graphics
// system in the specified resolution (HI_RES, MED_RES, LO_RES.)
//
// Parameters: mode=the graphics mode to use.
// can be: HI_RES, MED_RES, or LO_RES.
int gdriver, // Holds the name of the graphics driver (VGA Only.)
gmode; // Holds the name of the mode to use (use 'mode'parameter to specify.)
public:
screen(int mode); // Constructor that also starts graphics mode.
screen() {}; // Default constructor. Does nothing.
~screen(); // Default destructor. Closes the graphics system.
void init(int mode); // Used to start graphics if default constructor was used, or changing modes.
void close(); // Used to shut down graphics mode when changing modes.
};
class gbase
{
// This is a base class for all of the graphics objects in this library.
// it contains the basic location data, as well as the background data
// for the objects, as well as a few useful functions, and the basic
// functions NEEDED in all derived classes.
//
// Parameters: x,y = coordinates of the upper corner of the object.
// w,h = Width and height of the object.
// k = Flag: Keep track of the background or not.
//
// Preconditions: x and y must be positive.
// x+w must be <= the maximum posible x coordinate.
// y+h must be <= the maximum possible y coordinate.
protected:
int X, // The objects location and size.
Y,
Width,
Height,
isShown, // Is the object shown or not.
KeepBkg; // Keep track of the background or not.
void far *BackBuffer; // Holds the data for the background.
int BkgHndl; // The EMS handle for the BackBuffer.
int BkgPages; // Number of EMS pages for the BackBuffer. 0 if using main memory.
void ReSize(int w, int h); // Changes the width and height of a gbase object.
void virtual getbkg(); // copies the background of the object to BackBuffer.
public:
gbase(int x, int y, int w, int h, int k=1);// Inits a gbase object.
~gbase(); // Default destructor.
void virtual show() = 0; // pure virtual.
void virtual hide(); // Hides the image (removes it from the screen.)
int virtual hit(); // Determines if the cursor is on the object.
int virtual getX() // Returns the X coordinate of the upper left corner.
{return X; };
int virtual getY() // Returns the Y coordinate of the upper left corner.
{ return Y; };
int virtual getW() // Returns the Width of the item.
{ return Width; };
int virtual getH() // Returns the Height of the item.
{ return Height; };
int virtual shown() // Returns 1 if the item is shown, 0 if it isn't.
{ return isShown; };
void virtual moveto(int x, int y);// Moves an object to coordinates x,y.
};
class bitmap : public gbase
{
// This is the base class for graphic and icon. This class handles all
// routines associated with loading and displaying graphics.
//
// Parameters: x: The x coordinate of the upper left corner.
// y: The y coordinate of the upper left corner.
// fname : The name of the file containing the image data.
//
// Preconditions: x and y must both be positive.
// 'fname' must be a pathname to a valid existing bitmap.
// or a filename to a valid existing bitmap in the current directory.
// If mode = 0, then the bitmap must be NPG format (saved from the graphic object)
// else, if mode = 1, the picture is a 16 color PCX file.
// Also, the bitmap must be able to fit onto the screen, starting at (X,Y)
//
protected:
unsigned int ImageSize; // The size in bytes of the graphics image.
char far *Buffer; // The actual buffer storing the graphics image.
char get_imgpxl(int x, int y);
void put_imgpxl(int x, int y, char color);
public:
bitmap(int x, int y, int mode, char *fname="", int k=1); //Initializes a bitmap object.
~bitmap(); // The destructor.
void virtual load(char *fname, int mode = 0); // Loads a new bitmap into the object.
void virtual show(); // Displays the bitmap on the screen.
int virtual getW(); // Returns the width of the bitmap in pixels.
int virtual getH(); // Returns the height of the bitmap in pixels.
};
class panel : public gbase
{
// This class displays a blank panel on the screen.
//
// Parameters: x,y= coordinates of the top left corner of the flat surface of the panel.
// w=Width. Self Explanitory.
// h=Height. Self Explanitory.
// d=How high the panel should be raised.
// io=tells wether the panel should be raised (OUT) or sunken(IN).
// c= any color from BLACK to DARKGRAY (0-7).
// k= if 1, the background will be stored to allow hiding.
//
// Preconditions: X-Depth, and y-Depth must be positive.
// Also, X+Width+Depth must be less than the largest possible X coordinate.
// and Y+Height+Depth must be less than the largest possible Y coordinate.
// c must be between BLACK and LIGHTGRAY (0-7).
protected:
int Depth, // The panels depth (in pixels).
InorOut, // Wether the panel is concave or convex.
Color; // The panels color (valid from 0 to 7).
public:
panel(int x,int y,int w,int h, int d=1, int io=1,int c=7, int k=1); //Initializes a panel.
~panel(); // Destroys a panel.
void virtual resize (int w, int h); // Changes the panels height and width.
void moveto (int x, int y); // Move a panel.
void virtual setbkgclr(int c); // Changes the panels color.
void show (void); // Displays the panel.
};
class bevel : public panel
{
// This is similar to a panel, but is more like a frame. it consists of 2 panels.
// one concave, and one convex. /--\___________/--\
//
// Parameters: x,y = the coorinate of the upper left corner of the inner surface.
// w,h = the width and height of the inner surface.
// d = depth of the frame.
// bw = border width (width of the frame.)
// c = color of the bevel (defaults to light gray).
// k = keep background flag.
//
// Preconditions: x-d-bw and y-d-bw must be > 0
// x+w+2*(d+bw) must be < the greatest x coordinate for the current reslution.
// y+h+2*(d+bw) must be < the greatest y coordinate for the current resoution.
// bw must be >= 0
// c must be between BLACK and LIGHTGRAY (0-7).
protected:
panel *inner;
int BWidth;
public:
bevel (int x, int y, int w, int h, int d=1, int bw=3, int c=7, int k=1); //Initializes a bevel.
~bevel(); // Destroys a bevel.
void resize (int w, int h); // Changes a bevels height and width.
void moveto (int x, int y); // Move the bevel.
void show (); // Displays a bevel.
};
class button : public panel
{
// This is a general push-button. It can contain either an IMAGE or
// TEXT. If it is too small for the image or text, it will re-size itself.
//
// Parameters: x,y = The coordinate of the upper left corner of the top of the button.
// w,h = Width and height of the button. If to small, they will be automatically scaled.
// c = Color of the button part.
// m = Mode. Either TEXT ot IMAGE.
// strn = either the text to be displayed or the pathname of
// the image to be displayed.
//
// Preconditions: The button must fit within the bounds of the screen in the current mode.
// The color must be within BLACK and LIGHTGRAY (0 - 7)
// Mode must be TEXT or IMAGE (0 - 1).
// strn MUST point to a valid pathname if in IMAGE mode.
//
protected:
int TxtClr, // The color of any text displayed in the button.
HkHiClr, // The hotkey highlight color.
Border, // Thickness of the border around the button.
Mode; // What is inside (TEXT, or IMAGE) of the button.
char *String; // Holds the string in TEXT mode.
bitmap *Bgraphic; // The graphic image in the button.
int Selected; // Tells whether the button is perssed or up.
public:
button (int x, int y, int w, int h, int d, int c=7, int b=0, int m=0, char* strn=" ", int k=1); //Initializes a button.
~button();// Destroys a button.
void setextclr(int clr); // Changes the color of the text in TEXT mode.
void sethkhiclr(int clr); // Sets the hotkey highlight color.
void show(); // Displays a button
void select(); // 'Presses' a button, and marks it as selected.
int is_selected(); // Indicates wether or not a button is selected.
void setborder(int b); // Changes the border width on the button.
};
class graphic : public bitmap
{
// This object is a graphics image that can be captured from the current screen,
// or loaded in from disk. it can then be displayed, and moved on the screen.
// The parameters and preconditions are the same as for the graphic class.
public:
graphic(int x, int y, int k=1, int mode=0, char *fname=""); // Initializes a graphic image.
~graphic(); // Destroys a graphic.
void save(char *fname); // Saves the graphic in the buffer to the file fname.
void capture(int x, int y, int x1, int y1);// captures an area of the screen into the buffer.
};
class gmouse
{
// This is the all-impoortant mouse interface. It MUST be included in
// every application wether it is used or not. If it is not used, just do
// not arm it. You must, however decare an instance, and init it. Please
// declare the mouse class BEFORE the screen class.
// You must ARM the mouse to display it, and you MUST balance your use
// of SHOW and HIDE, otherwise you may get unpredictable results.
// If you use your own event handler, please make sure that the routine
// behave EXACTLY like an interrupt routine (save ALL the registers & flags)
// except that the handler should end with a far return.
int show_lvl,
num_btns;
public:
gmouse() {init();}; // Starts the mouse cursor system. THIS MUST BE DONE!
~gmouse(); // Shuts down the mouse system.
void init(); // completely resets the hardware and software of the system.
void arm(); // Arms the cursor, so that it can be shown.
void disarm(); // Disarms the mouse cursor.
void show(); // Shows the cursor on the screen.
void hide(); // Removes the cursor from the screen.
int getmX(); // Returns the mouses X coordinate.
int getmY(); // Returns the mouses Y coordinate.
int getbutton(int btn); // Returns the status of a particular button, or buttons.
int btnpressed(); // Returns true if any buttons are pressed.
void moveptr(int X, int Y);// moves the pointer to the coordinates X,Y
void setbounds(int left, int right, int top, int btm); // sets the horizontal and vertical bounds.
void setexclarea(int left, int right, int top, int btm);// Sets up an exclusion area.
void newpointer(int Type); // Changes the pointer to one of the predefined types.
void custmpointer(int X, int Y, unsigned int *ptr); // Allows you to create your own custom pointer.
int getrecentX(); // Returns the horiz. distance moved by the pointer since the last call.
int getrecentY(); // Returns the vert. distance moved since the last call.
void setevnthndlr( unsigned int mask, void far *pointer);// sets up a custom event handler.
void setdefhndlr(); // Sets up the default event handler.
int nextevent(int &X, int &Y, int &Btn); // returns the next event captured by the default handler.
void setsens( unsigned int x, unsigned int y); //Sets the sensitivity of the mouse.
};
class checkbox : public panel
{
//
// This is a checkbox object. it allows the user to check and un-check the
// box, and later, determine its state.
//
// Parameters: x,y - The location of the upper left corner of the box.
// w,h - The width and height of the inside of the box.
// d - The depth (in pixels) of the box.
// c - The color of the inside of the box.
// k - The keep track of the background flag.
//
// Preconditions: x,y,w,h,d MUST define a box that is within the bounds of the screen
// as in the Panel class.
// c must define a color between BLACK (0) and LIGHTGRAY (7).
// k must be 0 (FALSE) or 1 (TRUE).
protected:
int Selected, // Wether or not the box is checked.
LineWidth; // The width of the line.
public:
checkbox(int x, int y, int w=10, int h=10, int d=1, int c=7, int k=1); // Initializes a checkbox.
~checkbox(); // Destroyes a checkbox.
void setline(int w); // Sets the check line width, as in the BGI routine setlinewidth()
void setlineclr(int c); // changes the check lines color.
void show(); // Displays a check box, and de-selects the box.
void select(); // Selects (Checks) a box.
int is_selected(); // Returns TRUE (1) if the box is checked.
};
class rbutton : public gbase
{
//
// The RBUTTON is similar to the check box, except that it is a round button.
// Selected, a colored dot fills the button, an when cleared, the dot disappears.
//
// Parameters: x,y - Defines the location of the center of the button.
// r - The radius of the button.
// C - The color of the dot. The background is always light gray.
// k - The Keep track of the background flag.
//
// Preconditions: The button must fit within the bounds of the screen.
// The color can be ANY valid color.
// The k flag must be 0 or 1.
protected:
int Radius, // The radius of the button.
Color, // The color of the dot.
Selected; // Selected flag.
public:
rbutton(int x, int y, int R=5, int C=0, int k=1); // Initializes a rbutton object.
~rbutton(); // Deletes an rbutton.
void resize(int r); // Changes the radius of an rbutton.
void moveto(int x, int y); // Moves the rbutton.
void chgclr(int c); // Changes the dots color.
void show(); // Displays an rbutton, and de-selects it.
void select(); // Selects an rbutton.
int is_selected(); // Returns TRUE (1) if selected.
};
class icon : public bitmap
{
// An icon is a graphic image that can be used as a sort of a button.
// When selected, the image is shown reversed.
//
// Parameters: x,y - The coordinates of the upper left corner.
// fname- The pathname of a graphic to load.
// k - The keep track of the background flag.
//
// Preconditions: The picture must be able to fit on the screen,
// starting at (x,y).
// fname must be the pathname of an existing file.
//
//
protected:
int Selected; // Selected flag.
public:
icon(int x, int y, int mode, char *fname="", int k=1); // Initializes an icon.
~icon(); // Destroys an icon.
void show(); // Displays an icon, and de-selects it.
void select(); // Selects an icon, and re-displays its inverse,
int is_selected(); // Returns TRUE (1) if the icon is selected.
};
class instrn : public panel
{
// This class allows the input of a line of text inthe graphics mode.
// It exits its input when an up or down arrow, escape, or return key it depressed.
// The key that caused termination of input can be checked with 'lastkey()'
//
// Parameters: x,y - The coordinate of the upper left corner.
// w,h - The width and height of the box, in pixels.
// d - The depth in pixels of the box.
// c - The color of the background, the text defaults to white.
// k - The keep track of the background flag.
//
// Preconditions: The preconditions are the same as those for Panel.
//
//
protected:
int TxtColor, // The color of the text.
CsrColor, // The color of the text cursor
CsrBlink, // The cursor blink flag.
instmode, // Insert mode flag.
MaxLen, // The maximum string length.
Pointer, // The position of the text cursor.
HiClr, // The color of the highlight;
Hilight_Begin,
Hilight_End,
inkey; // The key pressed.
char *Buffer; // The buffer that stores the text.
public:
instrn(int x, int y, int w=1, int h=1, int d=0, int c=7, int k=1); // Initializes an instrn.
~instrn(); // Destroys an instrn.
void settxtclr(int clr); // Changes the text color. Can be ANY valid color.
void setcsrclr(int clr); // Changes the cursor color.
void sethiclr(int clr); // Set the highlight color;
void setcsrblink(int blk); // Changes the cursor blink flag: 1 to blink, 0 to not blink.
void show(); // Displays the instrn, and text in the buffer.
char *getinput(int hilight = 0); // Gets input from buffer, and return a pointer to it.
char lastkey(); // Retuirns the last key pressed.
void clear(); // Clears the buffer.
void preset (char *B); // Pre-loads the buffer with text.
char *gettext(char *buf); // Returns a copy of the string.
void hilight(int start, int end); // Highlights a block of text.
};
class menubar : public panel
{
// This class is a general purpose menu bar. Menus are added with the
// addmenu() function, and deleted with the delmenu() command. See the
// example in the manual for programming tips.
//
// Parameters: x,y - The upper left corner of the bar.
// w,h - The height and width of the bar. If it is too small, it
// will re-adjust itself to fit.
// c - The color of the bar.
// tc - The color of the text in the menubar.
// hc - The color of the highlight bar.
// heading - A text string used as the name of a menu.
// items - A string containing a comma seperated list of menu item names.
// Key - The hotkey associated with that menu. It must be the 2nd number in an extended key.
//
// Preconditions: x,y,w,h - The same as for the panel class with d=1.
// c - Must be between BLACK (0) and LIGHTGRAY (7).
// hc,tc - Can be any valid color.
// k - Must be 0 or 1
// no - Must be a valid menu number, starting at 1.
// Key - Must represent the second number returned by getch() for an
// extended keystroke. Please use the #defined numbers.
//
//
protected:
int TxtColor, // The color of the text.
HiColor, // The color of the highlight bar.
HkHiColor, // The color of the highlighted character in the heading.
BX, // Temporary values used for the pulldown menu size.
BY,
BW,
BH,
MenuSelected, // The number of the selected menu.
ItemSelected, // The number of the selected item of the selected menu.
lastMenuSelected, // The number of the last menu to be selected.
lastItemSelected, // The number of the last item to be selectd.
PulledDown, // A flag that tells that a menu is pulled down.
NumMenus, // The number of valid menus in the menubar.
NumItems, // The number of items in the currently selected menu.
MenuBkgHndl, // The EMS handle for the pulled down Bkg buffer, if using EMS.
MenuBkgPages; // The number of EMS pages needed for the pulled down Bkg buffer.
void far *MenuBackBuffer; // Stores the background for the pulled down menu.
struct itemTYPE // The linked list of items in a menu.
{
char Item[40]; // The items name.
int X, Y, Width, Height; // The area it takes up when pulled down.
struct itemTYPE *NextItem; // The next item in the list.
};
struct MenuTYPE // The linked list of menus.
{
char Heading[40]; // The name of the menu.
int X, Y, Width, Height; // Its area in the bar.
struct itemTYPE *Items; // A linked list of its items.
struct MenuTYPE *NextMenu; // The next menu in the list.
int hotkey; // The hotkey for this menu.
};
struct MenuTYPE *Menus; // The head for the menus linked list.
int find_char (char *str, char fnd, int begin); // finds a character in a string.
char *menubar::mids (char *strn, int begin, int count); // Breaks up a string.
public:
menubar(int x, int y, int w, int h, int c=7, int tc=15,int hc=12, int k=1);
~menubar();
void addmenu(char *heading, char *items, int Key=0); // Adds a menu to the menubar.
void delmenu(int no); // deletes a menu from the menubar.
void setbkgclr(int c); // Changes the color of the bar.
void settextclr(int c); // Changes the color of the text.
void sethighclr(int c); // Changes the color of the highlight bar.
void sethkhiclr(int C); // Sets the hotkey highlight color.
void show(); // Displays the menubar.
void pulldown(); // Pulls down the item list.
void pushup(); // Pushes the item list back up.
int menuhit(); // Returns the number of the menu the cursor is over.
int pdhit(); // Returns true if the cursor is over the pull-down menu.
int itemhit(); // returns the number of the item the cursor is over.
int ishtkey(int keypd); // Returns the number of the menu that keypd is the hotkey for, or 0 if not a hotkey.
int htkypressed(); // Checks to see if a hotkey was pressed. returns 0 if not, else the menu number.
void menuselect(int no); // selects a menu.
void itemselect(int no); // selects an item in the selected menu.
void menuclear(); // de-selects a menu, and its items.
void itemclear(); // de-selects the currently selected item only.
int itemselected(); // returns the number of the currently selected item.
int menuselected(); // returns the number of the currently selected menu.
int lastevntitem(); // returns the number of the selected item in checkforevent().
int lastevntmenu(); // returns the number of the selected menu in checkforevent().
void checkforevent(); // polls the keyboard and mouse for a menubar event.
// Allows the use of hotkeys, F-10, and arrow keys.
// Also handles event if you manually select a menu.
};
class vscroll : public panel
{
// This class is a vertical scroll bar. It is used as a selection device in scrolling
// windows applications. It returns a percent, or a pixel offset of the handle from it top
// most position. It can also be set with a percent or pixel offset. x,y,w,h define the size
// of the scrollbar, as in the panel. The depth is 1. hdh sets the height of the handle, and
// it's width is w-4, and it's depth is 1. bth defines the height of the up and down buttons.
// Their width is w-4, and as with all buttons, it's height is 2. If the button is large enough,
// an arrow will appear on the button. All components of the scroll bar can be operated manually,
// or the getevent function can be used to automate the bar.
button *Up,
*Dn;
panel *Hnd;
int Min_Position,
Max_Position,
Curr_Position,
Lines_Per_Page,
HDH,
BTH;
public:
vscroll(int x, int y, int w, int h, int hdh,int bht,int bc=7, int hc=7, int bkgc=7, int k=0);
~vscroll();
void show(void); // Shows a scrollbar.
void hide(void); // Hides a scrollbar.
void setpos(int p); // Sets the offset.
int getpos(void); // Gets the offset.
int uphit(void); // Up button hit.
int dnhit(void); // Down button hit.
int hndhit(void); // Handle hit.
void uppres(void); // Press the up button.
void dnpres(void); // Press the down button.
void uprels(void); // Release the up button.
void dnrels(void); // Release the down button.
int getevent(void); // Poll the scrollbar and handle events.
void resize (int w, int h); // Change the overall width & height of the bar. Does not change bht & hdh.
void moveto (int x, int y); // Move the scrollbar.
void setbkgclr(int c); // Set the scroll panel color.
void setbtnclr(int c); // Set the button color.
void sethdlclr(int c); // Set the handle color.
void setarrclr(int c); // Set the arrow's color.
void setrange(int min, int max); // Sets the range of the scroll bar.
void setpagesize(int LPP); // Sets the number of lines per page.
};
class hscroll : public panel
{
// This is a horizontal scroll bar. It is the same as the vertical scroll bar
// except that the button width and handle width (instead of height) are defined, and
// the offsets and % is for the x axis, and not the y.
//
button *Lf,
*Rt;
panel *Hnd;
int Min_Position,
Max_Position,
Curr_Position,
Lines_Per_Page,
HDW,
BTW;
public:
hscroll(int x, int y, int w, int h, int hdw,int bhw,int bc=7, int hc=7, int bkgc=7, int k=0);
~hscroll();
void show(void);
void hide(void);
void setpos(int p);
int getpos(void);
int lfhit(void);
int rthit(void);
int hndhit(void);
void lfpres(void);
void rtpres(void);
void lfrels(void);
void rtrels(void);
int getevent(void);
void resize (int w, int h);
void moveto (int x, int y);
void setbkgclr(int c);
void setbtnclr(int c);
void sethdlclr(int c);
void setarrclr(int c);
void setrange(int min, int max); // Sets the range of the scroll bar.
void setpagesize(int LPP);
};
// Miscellaneous Functions:
// These functions are used to get input from the keyboard, if not using the
// instrn class or the textplane class in the guicls file. You MUST use these
// instead of getch() and kbhit(). Failure to do so can cause your program
// to hang up in the menubar::getevent and menubar::htkypressed functions.
// These functions handle extended keys differently than getch(). Instead of
// returning 0 to indicate that the next key extracted is extended, if the high
// byte is 1, then the low byte is an extended key. (normal keys: 0-255, extended
// keys: 256-512).
//
// The function getkbflags() returns the following: bit meaning
// --- -------
// 7 Insert is ON.
// 6 Caps Lock ON.
// 5 Num Lock ON.
// 4 Scroll Lock is ON.
// 3 Alt key is pressed.
// 2 Ctrl Key is pressed.
// 1 Left SHIFT is pressed.
// 0 Right SHIFT is pressed.
#define KBD_INS_ON 0x80
#define KBD_CAP_ON 0x40
#define KBD_NUM_ON 0x20
#define KBD_SCR_ON 0x10
#define KBD_ALT_PR 0x08
#define KBD_CTL_PR 0x04
#define KBD_LSH_PR 0x02
#define KBD_RSH_PR 0x01
int keyhit(); // Returns true if a key has been pressed, or one is in the buffer.
int getkey(); // Returns the next key in the buffer.
int getkbflags(); // Returns the status of the keyboard flags.
int putbk(int keypb); // Pushes a key back to the buffer.
#endif