1360 |
mateusz.vi |
1 |
/*
|
|
|
2 |
* Console output
|
|
|
3 |
*
|
|
|
4 |
* This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
|
|
|
5 |
* Published under the terms of the MIT License, as stated below.
|
|
|
6 |
*
|
|
|
7 |
* Copyright (C) 2014-2023 Mateusz Viste
|
|
|
8 |
*
|
|
|
9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
10 |
* of this software and associated documentation files (the "Software"), to
|
|
|
11 |
* deal in the Software without restriction, including without limitation the
|
|
|
12 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
13 |
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
14 |
* furnished to do so, subject to the following conditions:
|
|
|
15 |
*
|
|
|
16 |
* The above copyright notice and this permission notice shall be included in
|
|
|
17 |
* all copies or substantial portions of the Software.
|
|
|
18 |
*
|
|
|
19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
24 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
25 |
* IN THE SOFTWARE.
|
|
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
#ifndef MDR_COUT
|
|
|
29 |
#define MDR_COUT
|
|
|
30 |
|
|
|
31 |
/* inits the subsystem, fills arguments with:
|
|
|
32 |
* w = screen width
|
|
|
33 |
* h = screen height
|
|
|
34 |
* Any of these arguments may be passed as NULL
|
|
|
35 |
* Returns a color flag (0=mono, non-zero=color) */
|
|
|
36 |
unsigned char mdr_cout_init(unsigned char *w, unsigned char *h);
|
|
|
37 |
|
|
|
38 |
/* get current attribute value under cursor and returns it */
|
|
|
39 |
int mdr_cout_getcurattr(void);
|
|
|
40 |
|
|
|
41 |
void mdr_cout_close(void);
|
|
|
42 |
void mdr_cout_cursor_hide(void);
|
|
|
43 |
void mdr_cout_cursor_show(void);
|
|
|
44 |
|
|
|
45 |
/* gets cursor's position on screen (row, column) and shape */
|
|
|
46 |
void mdr_cursor_getinfo(unsigned char *column, unsigned char *row, unsigned short *shape);
|
|
|
47 |
|
|
|
48 |
void mdr_cout_locate(unsigned char row, unsigned char column);
|
|
|
49 |
|
|
|
50 |
/* print a single character on screen */
|
|
|
51 |
void mdr_cout_char(unsigned char y, unsigned char x, char c, unsigned char attr);
|
|
|
52 |
|
|
|
53 |
/* print a single character on screen, repeated count times */
|
|
|
54 |
void mdr_cout_char_rep(unsigned char y, unsigned char x, char c, unsigned char attr, unsigned char count);
|
|
|
55 |
|
|
|
56 |
/* print a nul-terminated string on screen, up to maxlen characters
|
|
|
57 |
* returns the number of characters actually displayed */
|
|
|
58 |
unsigned char mdr_cout_str(unsigned char y, unsigned char x, const char *s, unsigned char attr, unsigned char maxlen);
|
|
|
59 |
|
|
|
60 |
/* clears screen, filling it with a single color attribute */
|
|
|
61 |
void mdr_cout_cls(unsigned char colattr);
|
|
|
62 |
|
|
|
63 |
void mdr_cout_getconprops(unsigned char *termwidth, unsigned char *termheight, unsigned char *colorflag);
|
|
|
64 |
|
|
|
65 |
/* functions below do not need mdr_cout_init() initialization, they may be
|
|
|
66 |
* used to display characters or nul-terminated strings to console right away
|
|
|
67 |
* as they use DOS services */
|
|
|
68 |
void mdr_coutraw_char(char c);
|
|
|
69 |
void mdr_coutraw_puts(const char *s);
|
|
|
70 |
|
|
|
71 |
#endif
|