FDOSTUI
FreeDOS Text User Interface
screen.h
Go to the documentation of this file.
1 /*
2  SCREEN.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __screen_h__
11 
12 #if (defined(__DOS__) || defined(__DJGPP__)) && !defined(__CURSES__)
13 typedef unsigned short int screen_block_t;
14 typedef unsigned char screen_char_t;
15 #endif
16 
17 #if defined(__NT__)
18 # ifdef _WIN32_WINNT
19 # undef _WIN32_WINNT
20 # endif
21 #define _WIN32_WINNT 0x0500
22 #include <windows.h>
23 typedef CHAR_INFO screen_block_t;
24 typedef unsigned char screen_char_t;
25 #endif
26 
27 #ifdef __CURSES__
28 #include <curses.h>
29 typedef chtype screen_block_t;
30 typedef chtype screen_char_t;
31 #endif
32 
33 #ifndef __FAR
34 # if defined(__FLAT__ ) || defined(__LARGE__)
35 # define __FAR
36 # else
37 # define __FAR __far
38 # endif
39 #endif
40 
41 #if (defined(__DOS__) || defined(__DJGPP__)) && !defined(__CURSES__)
42 
44 {
51  /* fcolor_brown = 6, */
52  /* fcolor_light_gray = 7, */
53  /* fcolor_gray = 8, */
54  /* fcolor_light_blue = 9, */
55  /* fcolor_light_green = 10, */
56  /* fcolor_light_cyan = 11, */
57  /* fcolor_light_red = 12, */
58  /* fcolor_light_magenta = 13, */
61 };
62 
63 #endif /* (defined(__DOS__) || defined(__DJGPP__)) && !defined(__CURSES__) */
64 
65 #if defined(__NT__) && !defined(__CURSES__)
66 
67 #define FCOLOR_BLACK (0)
68 #define FCOLOR_RED (FOREGROUND_RED)
69 #define FCOLOR_GREEN (FOREGROUND_GREEN)
70 #define FCOLOR_BLUE (FOREGROUND_BLUE)
71 #define FCOLOR_YELLOW (FOREGROUND_RED | FOREGROUND_GREEN)
72 #define FCOLOR_MAGENTA (FOREGROUND_RED | FOREGROUND_BLUE)
73 #define FCOLOR_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
74 #define FCOLOR_CYAN (FOREGROUND_GREEN | FOREGROUND_BLUE)
75 
76 #define FCOLOR_LIGHT_BLACK (FCOLOR_BLACK | FOREGROUND_INTENSITY)
77 #define FCOLOR_LIGHT_RED (FCOLOR_RED | FOREGROUND_INTENSITY)
78 #define FCOLOR_LIGHT_GREEN (FCOLOR_GREEN | FOREGROUND_INTENSITY)
79 #define FCOLOR_LIGHT_BLUE (FCOLOR_BLUE | FOREGROUND_INTENSITY)
80 #define FCOLOR_LIGHT_YELLOW (FCOLOR_YELLOW | FOREGROUND_INTENSITY)
81 #define FCOLOR_LIGHT_MAGENTA (FCOLOR_MAGENTA | FOREGROUND_INTENSITY)
82 #define FCOLOR_LIGHT_WHITE (FCOLOR_WHITE | FOREGROUND_INTENSITY)
83 #define FCOLOR_LIGHT_CYAN (FCOLOR_CYAN | FOREGROUND_INTENSITY)
84 
86 {
87  fcolor_black = FCOLOR_BLACK,
88  fcolor_blue = FCOLOR_BLUE,
89  fcolor_green = FCOLOR_GREEN,
90  fcolor_cyan = FCOLOR_CYAN,
91  fcolor_red = FCOLOR_RED,
92  fcolor_magenta = FCOLOR_MAGENTA,
93  fcolor_yellow = FCOLOR_YELLOW,
94  fcolor_white = FCOLOR_WHITE
95 };
96 
97 #endif /* #if defined(__NT__) && !defined(__CURSES__) */
98 
99 #if defined(__CURSES__)
100 
102 {
103  fcolor_black = COLOR_BLACK,
104  fcolor_blue = COLOR_BLUE,
105  fcolor_green = COLOR_GREEN,
106  fcolor_cyan = COLOR_CYAN,
107  fcolor_red = COLOR_RED,
108  fcolor_magenta = COLOR_MAGENTA,
109  fcolor_yellow = COLOR_YELLOW,
110  fcolor_white = COLOR_WHITE
111 };
112 
113 #endif /* #if defined(__CURSES__) */
114 
115 #if (defined(__DOS__) || defined(__DJGPP__)) && !defined(__CURSES__)
116 
118 {
125  /* bcolor_brown = 6, */
127 };
128 
129 #endif /* (defined(__DOS__) || defined(__DJGPP__)) && !defined(__CURSES__) */
130 
131 #if defined(__NT__) && !defined(__CURSES__)
132 
133 #define BCOLOR_BLACK (0)
134 #define BCOLOR_RED (BACKGROUND_RED)
135 #define BCOLOR_GREEN (BACKGROUND_GREEN)
136 #define BCOLOR_BLUE (BACKGROUND_BLUE)
137 #define BCOLOR_YELLOW (BACKGROUND_RED | BACKGROUND_GREEN)
138 #define BCOLOR_MAGENTA (BACKGROUND_RED | BACKGROUND_BLUE)
139 #define BCOLOR_WHITE (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
140 #define BCOLOR_CYAN (BACKGROUND_GREEN | BACKGROUND_BLUE)
141 
142 #define BCOLOR_LIGHT_BLACK (BCOLOR_BLACK | BACKGROUND_INTENSITY)
143 #define BCOLOR_LIGHT_RED (BCOLOR_RED | BACKGROUND_INTENSITY)
144 #define BCOLOR_LIGHT_GREEN (BCOLOR_GREEN | BACKGROUND_INTENSITY)
145 #define BCOLOR_LIGHT_BLUE (BCOLOR_BLUE | BACKGROUND_INTENSITY)
146 #define BCOLOR_LIGHT_YELLOW (BCOLOR_YELLOW | BACKGROUND_INTENSITY)
147 #define BCOLOR_LIGHT_MAGENTA (BCOLOR_MAGENTA | BACKGROUND_INTENSITY)
148 #define BCOLOR_LIGHT_WHITE (BCOLOR_WHITE | BACKGROUND_INTENSITY)
149 #define BCOLOR_LIGHT_CYAN (BCOLOR_CYAN | BACKGROUND_INTENSITY)
150 
152 {
153  bcolor_black = BCOLOR_BLACK,
154  bcolor_blue = BCOLOR_BLUE,
155  bcolor_green = BCOLOR_GREEN,
156  bcolor_cyan = BCOLOR_CYAN,
157  bcolor_red = BCOLOR_RED,
158  bcolor_magenta = BCOLOR_MAGENTA,
159  bcolor_light_gray = BCOLOR_WHITE
160 };
161 
162 #endif /* #if defined(__NT__) && !defined(__CURSES__) */
163 
164 #if defined(__CURSES__)
165 
167 {
168  bcolor_black = COLOR_BLACK,
169  bcolor_blue = COLOR_BLUE,
170  bcolor_green = COLOR_GREEN,
171  bcolor_cyan = COLOR_CYAN,
172  bcolor_red = COLOR_RED,
173  bcolor_magenta = COLOR_MAGENTA,
174  bcolor_light_gray = COLOR_WHITE
175 };
176 
177 #endif /* #if defined(__CURSES__) */
178 
179 #ifdef __cplusplus
180 extern "C" {
181 #endif
182 
183 extern unsigned int _video_cols;
184 extern unsigned int _video_rows;
185 
186 #if defined(__CURSES__)
187 extern int _video_has_color;
188 #endif
189 
190 extern int screen_init();
191 
192 extern void screen_deinit();
193 
194 extern int
196 
197 extern int
199 
200 #if defined(__CURSES__)
201 #define screen_set25lines() -1
202 #define screen_set50lines() -1
203 #endif
204 
205 #if defined(__NT__) || defined(__CURSES__)
206 extern void
207 screen_changed_size();
208 #endif
209 
210 extern void
212  screen_char_t const i_char,
213  enum foreground const i_fcolor,
214  enum background const i_bcolor);
215 
216 extern void
218  int const i_col,
219  int const i_row,
220  unsigned int const i_columns,
221  unsigned int const i_rows,
222  screen_char_t const i_char,
223  enum foreground const i_fcolor,
224  enum background const i_bcolor);
225 
226 extern void
228  int const i_col,
229  int const i_row,
230  screen_char_t const i_char,
231  unsigned int const i_repeat_count,
232  enum foreground const i_fcolor,
233  enum background const i_bcolor);
234 
235 extern void
237  int const i_col,
238  int const i_row,
239  screen_char_t const i_char,
240  unsigned int const i_repeat_count,
241  enum foreground const i_fcolor,
242  enum background const i_bcolor);
243 
244 extern void
246  int const i_col,
247  int const i_row,
248  unsigned char const __FAR* i_string,
249  unsigned int const i_length,
250  enum foreground const i_fcolor,
251  enum background const i_bcolor);
252 
253 extern void
255  int const i_col,
256  int const i_row,
257  unsigned int const i_repeat_count,
258  enum foreground const i_fcolor,
259  enum background const i_bcolor);
260 
261 extern screen_block_t
263  int const i_col,
264  int const i_row);
265 
266 extern screen_block_t __FAR*
268  screen_block_t __FAR* o_block,
269  unsigned int const i_columns,
270  int const i_col,
271  int const i_row);
272 
273 extern screen_block_t const __FAR*
275  int const i_col,
276  int const i_row,
277  screen_block_t const __FAR* i_block,
278  unsigned int const i_columns);
279 
280 extern void
281 screen_push(
282  int const i_copy);
283 
284 extern void
285 screen_pop();
286 
287 #if defined(__FLAT__) && !defined(__NT__)
288 #define screen_push(i_copy)
289 #define screen_pop()
290 #endif
291 
292 #ifdef __cplusplus
293 }
294 #endif
295 
296 #define __screen_h__
297 #endif
Definition: screen.h:46
void screen_fill(screen_char_t const i_char, enum foreground const i_fcolor, enum background const i_bcolor)
fill entire screen display
Definition: djgpp/screen.c:160
Definition: screen.h:49
Definition: screen.h:60
unsigned int _video_rows
Definition: djgpp/screen.c:25
Definition: screen.h:45
Definition: screen.h:59
Definition: screen.h:120
void screen_puts(int const i_col, int const i_row, unsigned char const __FAR *i_string, unsigned int const i_length, enum foreground const i_fcolor, enum background const i_bcolor)
draw a string to the screen
void screen_deinit()
returns the screen to mode on entry
Definition: djgpp/screen.c:83
screen_block_t screen_getc(int const i_col, int const i_row)
reads a character and it&#39;s attribute from the screen
Definition: djgpp/screen.c:601
void screen_set_color(int const i_col, int const i_row, unsigned int const i_repeat_count, enum foreground const i_fcolor, enum background const i_bcolor)
sets the foreground and background color of a horizontal region
Definition: djgpp/screen.c:524
Definition: screen.h:48
Definition: screen.h:47
Definition: screen.h:50
void screen_putc(int const i_col, int const i_row, screen_char_t const i_char, unsigned int const i_repeat_count, enum foreground const i_fcolor, enum background const i_bcolor)
draw a character to the screen
Definition: djgpp/screen.c:280
Definition: screen.h:122
screen_block_t __FAR * screen_read(screen_block_t __FAR *o_block, unsigned int const i_columns, int const i_col, int const i_row)
read a line of screen memory
Definition: djgpp/screen.c:643
background
background color
Definition: screen.h:117
screen_block_t const __FAR * screen_write(int const i_col, int const i_row, screen_block_t const __FAR *i_block, unsigned int const i_columns)
write a line of screen memory
Definition: djgpp/screen.c:669
Definition: screen.h:119
int screen_init()
configures the display screen
Definition: djgpp/screen.c:29
unsigned int _video_cols
Definition: djgpp/screen.c:24
int screen_set25lines()
set 25 line screen mode
Definition: djgpp/screen.c:95
Definition: screen.h:123
foreground
foreground colors
Definition: screen.h:43
int screen_set50lines()
set 50 line screen mode
Definition: djgpp/screen.c:114
Definition: screen.h:124
Definition: screen.h:121
void screen_fill_area(int const i_col, int const i_row, unsigned int const i_columns, unsigned int const i_rows, screen_char_t const i_char, enum foreground const i_fcolor, enum background const i_bcolor)
fill an area of the screen
Definition: djgpp/screen.c:191
Definition: screen.h:126
void screen_putvc(int const i_col, int const i_row, screen_char_t const i_char, unsigned int const i_repeat_count, enum foreground const i_fcolor, enum background const i_bcolor)
draw a character to the screen
Definition: djgpp/screen.c:360