tcursesport.h - vaccinewars - be a doctor and try to vaccinate the world
HTML git clone git://src.adamsgaard.dk/vaccinewars
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
tcursesport.h (3684B)
---
1 /************************************************************************
2 * cursesport.h Portability functions to enable curses applications *
3 * to be built on Win32 systems *
4 * Copyright (C) 1998-2021 Ben Webb *
5 * Email: benwebb@users.sf.net *
6 * WWW: https://dopewars.sourceforge.io/ *
7 * *
8 * This program is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
21 * MA 02111-1307, USA. *
22 ************************************************************************/
23
24 #ifndef __CURSESPORT_H__
25 #define __CURSESPORT_H__
26
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30
31 #include <glib.h>
32
33 #ifdef CYGWIN /* Definitions for native Win32 build */
34 #include <winsock2.h>
35 #include <windows.h>
36 #include <string.h>
37
38 #include <stdio.h>
39 #include <conio.h>
40
41 extern int COLS, LINES;
42
43 #define COLOR_MAGENTA 1
44 #define COLOR_BLACK 2
45 #define COLOR_WHITE 3
46 #define COLOR_BLUE 4
47 #define COLOR_RED 5
48
49 #define COLOR_PAIR(i) ((i) << 16)
50
51 #define ACS_VLINE 0x2502
52 #define ACS_ULCORNER 0x250c
53 #define ACS_HLINE 0x2500
54 #define ACS_URCORNER 0x2510
55 #define ACS_TTEE 0x252c
56 #define ACS_LLCORNER 0x2514
57 #define ACS_LRCORNER 0x2518
58 #define ACS_BTEE 0x2534
59 #define ACS_LTEE 0x251c
60 #define ACS_RTEE 0x2524
61
62 typedef int SCREEN;
63
64 #define stdscr 0
65 #define curscr 0
66 #define KEY_ENTER 13
67 #define KEY_BACKSPACE 8
68 #define A_BOLD 0
69
70 SCREEN *newterm(void *, void *, void *);
71 void refresh(void);
72 #define wrefresh(win) refresh()
73 void start_color(void);
74 void init_pair(int index, WORD fg, WORD bg);
75 void cbreak(void);
76 void noecho(void);
77 void nodelay(void *, char);
78 void keypad(void *, char);
79 void curs_set(BOOL visible);
80 void endwin(void);
81 void move(int y, int x);
82 void attrset(int newAttr);
83 void addstr(const char *str);
84 void addch(unsigned ch);
85 void mvaddstr(int x, int y, const char *str);
86 void mvaddch(int x, int y, int ch);
87
88 #define erase() clear_screen()
89
90 void standout(void);
91 void standend(void);
92 void endwin(void);
93
94 #else /* Definitions for Unix build */
95 #include <errno.h>
96
97 /* Include a suitable curses-type library */
98 #if HAVE_LIBNCURSES || defined(CURSES_HAVE_NCURSES_H)
99 #include <ncurses.h>
100 #elif HAVE_LIBCURSES || defined(CURSES_HAVE_CURSES_H)
101 #include <curses.h>
102 #elif defined(CURSES_HAVE_NCURSES_NCURSES_H)
103 #include <ncurses/ncurses.h>
104 #elif defined(CURSES_HAVE_NCURSES_CURSES_H)
105 #include <ncurses/curses.h>
106 #elif HAVE_LIBCUR_COLR
107 #include <curses_colr/curses.h>
108 #endif
109
110 #endif /* CYGWIN */
111
112 gunichar bgetch(void);
113
114 #endif /* __CURSESPORT_H__ */