-
Notifications
You must be signed in to change notification settings - Fork 1
/
conio.cpp
executable file
·60 lines (46 loc) · 1.13 KB
/
conio.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***
conio.cpp
Implementation of some console I/O functions that were supported by
Turbo C and DJGPP (<conio.h>). Helpful when porting older code.
Copyright (c) 2014-2022 C. M. Street.
***/
#ifdef PDCURSES_OK
/*** Clear to the end of the current line. ***/
void clreol(void) {
ansi_puts("\033[K");
}
/*** Clear the screen. ***/
void clrscr(void) {
ansi_puts(ANSI_CLEAR_SCREEN);
}
/*** Puts a string to the console. Returns 0 on success. ***/
int cputs(const char* str) {
ansi_puts(str);
return 0;
}
/*** Delete the current line. ***/
// TODO: this should scroll lines below the current line up.
void delline(void) {
ansi_puts("\033[2K");
}
/*** Set the cursor position. ***/
void gotoxy(int x, int y) {
move(y, x);
}
/*** Set the current text attributes. ***/
void textattr(int attr) {
// TODO: TBI
}
/*** Set the text's background color. ***/
void textbackground(int clr) {
// TODO: TBI
}
/*** Return the position of the cursor. ***/
int wherex(void) {
return getcurx(stdscr);
}
int wherey(void) {
return getcury(stdscr);
}
#endif // PDCURSES_OK
/*** end conio.cpp ***/