3 /* The primary purpose of this function is to provide CONSOLE_*
4 reotines that immediately call the appropiate driver handler.
5 This cleans up code in the individual modules considerably.
6 This could be done using a macro, but additional functionality
7 may be provided here in the future. */
15 /* I did this without realizing that CONSOLE_* was actually used by
16 the Win32 console driver. I will definately have to rename these
17 functions to avoid the name clash... */
19 void CONSOLE_Write(char out
, int fg_color
, int bg_color
, int attribute
)
23 driver
.write(out
, fg_color
, bg_color
, attribute
);
24 if (!driver
.norefresh
)
31 /* Suitable defaults... */
32 driver
.console_out
= stdout
;
33 driver
.console_in
= stdin
;
34 /* Eventually, this will be a command-line choice */
54 void CONSOLE_MoveCursor(char row
, char col
)
56 if (driver
.moveCursor
)
58 driver
.moveCursor(row
, col
);
59 if (!driver
.norefresh
)
64 void CONSOLE_ClearWindow(char row1
, char col1
, char row2
, char col2
,
65 int bg_color
, int attribute
)
67 if (driver
.clearWindow
)
69 driver
.clearWindow(row1
, col1
, row2
, col2
, bg_color
, attribute
);
70 if (!driver
.norefresh
)
75 void CONSOLE_ScrollUpWindow(char row1
, char col1
, char row2
, char col2
,
76 char lines
, int bg_color
, int attribute
)
78 if (driver
.scrollUpWindow
)
80 driver
.scrollUpWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,
82 if (!driver
.norefresh
)
87 void CONSOLE_ScrollDownWindow(char row1
, char col1
, char row2
, char col2
,
88 char lines
, int bg_color
, int attribute
)
90 if (driver
.scrollDownWindow
)
92 driver
.scrollDownWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,
94 if (!driver
.norefresh
)
99 int CONSOLE_CheckForKeystroke(char *scan
, char *ascii
)
100 /* These functions need to go through a conversion layer. Scancodes
101 should *not* be determined by the driver, rather they should have
102 a conv_* function in int16.c. Yuck. */
104 if (driver
.checkForKeystroke
)
105 return driver
.checkForKeystroke(scan
, ascii
);
110 void CONSOLE_GetKeystroke(char *scan
, char *ascii
)
112 if (driver
.getKeystroke
)
113 return driver
.getKeystroke(scan
, ascii
);
116 void CONSOLE_GetCursorPosition(char *row
, char *col
)
118 if (driver
.getCursorPosition
)
119 return driver
.getCursorPosition(row
, col
);
122 void CONSOLE_GetCharacterAtCursor(char *ch
, int *fg
, int *bg
, int *a
)
124 if (driver
.getCharacterAtCursor
)
125 return driver
.getCharacterAtCursor(ch
, fg
, bg
, a
);
128 void CONSOLE_Refresh()
131 return driver
.refresh();
134 /* This function is only at the CONSOLE level. */
135 /* Admittably, calling the variable norefresh might be a bit dumb...*/
136 void CONSOLE_SetRefresh(int setting
)
139 driver
.norefresh
= FALSE
;
141 driver
.norefresh
= TRUE
;
144 /* This function is only at the CONSOLE level. */
145 int CONSOLE_GetRefresh()
147 if (driver
.norefresh
)
153 void CONSOLE_ClearScreen()
155 if (driver
.clearScreen
)
156 return driver
.clearScreen();
159 char CONSOLE_GetCharacter()
161 /* I'm not sure if we need this really. This is a function that can be
162 accelerated that returns the next *non extended* keystroke */
163 if (driver
.getCharacter
)
164 return driver
.getCharacter();
166 return (char) 0; /* Sure, this will probably break programs... */