home *** CD-ROM | disk | FTP | other *** search
- (* A graphics Window unit designed for the Adventure System *)
- Unit Windows;
- (******************************)
- (* Todd Fiala *)
- (* Graphics Window System *)
- (* 11/28/89 *)
- (******************************)
-
- (***********)
- Interface
- (***********)
- var
- ShowBor, (* True: Draws a border around window *)
- HitKey : boolean; (* True: Window will only stay open till key hit *)
- TextCol, (* Text Color for Window *)
- BorCol, (* Border Color for Window *)
- BackCol : word; (* Background Color for Window *)
-
- (****************************)
- (* Procedures and Functions *)
- (****************************)
-
- (*************************************)
- (* Procedure ClearText *)
- (* Purpose : Clears the Text Buffer. *)
- (*************************************)
- Procedure ClearText;
-
- (*************************************************)
- (* Procedure BufEmpty *)
- (* Purpose : Checks if the Text Buffer is empty *)
- (* Returns : True if the buffer isn't empty *)
- (*************************************************)
- Function BufEmpty : boolean;
-
- (********************************************************************)
- (* Procedure WriteWndw *)
- (* Purpose : Adds text to the text buffer for the next window to be *)
- (* opened. *)
- (* Input : AddString, the string to add to the buffer. *)
- (********************************************************************)
- Procedure WriteWndw(AddString : string);
-
- (********************************************************)
- (* Procedure SetBuf *)
- (* Purpose : Set the buffer for reading from beginning. *)
- (********************************************************)
- Procedure SetBuf;
-
- (******************************************************)
- (* Function ReadBuf *)
- (* Purpose : Read the next character from the buffer. *)
- (* Returns : false if buffer has been read to end. *)
- (* Out : ch - the next character from the buffer. *)
- (******************************************************)
- Function ReadBuf(var ch : char) : boolean;
-
- (*****************************************************************)
- (* Procedure GraphWndw *)
- (* Purpose : Make a window on the screen, saving area behind it. *)
- (* Input : Window (x1,y1) upper left, and (x2,y2) lower right *)
- (* Output : Window with border. *)
- (*****************************************************************)
- Procedure GraphWndw(x1,y1,x2,y2 : word);
-
- (*************************************************************************)
- (* Function GrPos *)
- (* Purpose : converts graphics mode equate to the given text coordinate. *)
- (* Return : graphics position. *)
- (* Input : TextPos, the text mode coordinate. *)
- (*************************************************************************)
- Function GrPos(TextPos : word) : word;
-
- (***************************************************************)
- (* Procedure FormatBuf *)
- (* Purpose : Format the text buffer to the size of the window *)
- (* Input : WndwLen, the length of the window to format for *)
- (***************************************************************)
- Procedure FormatBuf(WndwLen : byte);
-
- (*******************************************************************)
- (* Procedure WriteText *)
- (* Purpose : Print the text from the buffer in a window. *)
- (* Input : x1,x2 for borders, y for starting y position. *)
- (* Output : Text printed from Text Buffer from x1 to x2, starting *)
- (* at y. Make sure your window is long(y) enough! *)
- (*******************************************************************)
- Procedure WriteText(x1,y,x2 : word);
-
- (*************************************************************************)
- (* Procedure CloseWndw *)
- (* Purpose : Will close the last open window. *)
- (* Output : Will set WindowError to 1 if no open windows when executed. *)
- (*************************************************************************)
- Procedure CloseWndw;
-
- (***************************************************************************)
- (* Procedure OpenWndw *)
- (* Purpose : Adds text to buffer and opens up a window at the coords. *)
- (* given. *)
- (* Input : Window's (x1,y1) for upper left, (x2,y2) for lower right hand *)
- (* coordinates of the window. *)
- (* Output : Window with all current text data. *)
- (***************************************************************************)
- Procedure OpenWndw(AddString : string;x1,y1,x2,y2 : word);
-
- (********************************************************************)
- (* Function CursorWndw *)
- (* Purpose : Adds text to text buffer, opens up a window with text, *)
- (* and reads in a line of text. *)
- (* Returns : String containing what was typed. *)
- (* Input : AddString is any text to add to the buffer. Will *)
- (* read input from keyboard. *)
- (* Output : Window with space for typing. *)
- (********************************************************************)
- Function CursorWndw(AddString : string) : string;
-
- (*****************************************************************)
- (* Procedure ShowWndw; *)
- (* Purpose : Centers a window on screen and writes out formatted *)
- (* text. *)
- (* Input : Text, to add to the text buffer *)
- (*****************************************************************)
- Procedure ShowWndw(text : string);
-
- (********************************************************************)
- (* Procedure ClearAllWndws *)
- (* Purpose : Will close all open windows and clear the text buffer. *)
- (* Output : All open windows will be removed from the screen. *)
- (********************************************************************)
- Procedure ClearAllWndws;