-
Notifications
You must be signed in to change notification settings - Fork 2
/
schemes.h
170 lines (150 loc) · 4 KB
/
schemes.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
contains color/monchrome schemes for tty-mines.
*/
#ifndef __SCHEMES_H__
#define __SCHEMES_H__
#define SGR(color, string) "\033[" color "m" string "\033[0m"
#define BOLD "1"
#define BLINK "5"
#define REV "7"
#define RED "31"
#define GREEN "32"
#define YELLOW "33"
#define BLUE "34"
#define CYAN "36"
#define GREY "37"
#define BRED "91"
#define BBLUE "94"
#define WHITE "97"
enum e_emoticons {
EMOT_SMILE,
EMOT_DEAD,
EMOT_WON,
EMOT_OHH,
NUM_EMOT,
};
enum e_border_lines {
B_TOP,
B_STATUS,
B_DIVIDER,
B_FIELD,
B_BOTTOM,
};
enum e_border_cols {
B_LEFT,
B_MIDDLE,
B_RIGHT,
};
struct minescheme {
char* number[9];
char* field_closed;
char* field_flagged;
char* field_question;
char* mine_normal;
char* mine_death;
char* mine_wrongf;
char* mine_wrongq;
char* emoticons[NUM_EMOT];
char* border[5][3];
int cell_width;
int display_width;
char* init_seq;
char* reset_seq;
};
struct minescheme symbols_mono = {
.number = {" ", "1", "2", "3", "4", "5", "6", "7", "8"},
.field_closed = "░░",
.field_flagged = "▕▀",
.field_question = "?",
.mine_normal = "*",
.mine_death = "#",
.mine_wrongf = "/",
.mine_wrongq = "\",
.emoticons = {":)", ":(", ":D", ":o"},
.border = {{"╔═","══","═╗"},
{"║ "," "," ║"},
{"╟─","──","─╢"},
{"║ "," "," ║"},
{"╚═","══","═╝"}},
.cell_width = 2,
.display_width = 2,
};
struct minescheme symbols_col1 = {
.number = {" ",
SGR(BBLUE, "1"),
SGR(GREEN, "2"),
SGR(RED, "3"),
SGR(BLUE, "4"),
SGR(YELLOW,"5"),
SGR(CYAN, "6"),
SGR(GREY, "7"),
SGR(WHITE, "8")},
.field_closed = "░░",
.field_flagged = SGR(GREY,"▕\033["BRED"m▀"),
.field_question = "?",
.mine_normal = "*",
.mine_death = SGR(RED,"*"),
.mine_wrongf = "/",
.mine_wrongq = "\",
.emoticons = {":)", ":(", ":D", ":o"},
.border = {{"╔═","══","═╗"},
{"║ "," "," ║"},
{"╟─","──","─╢"},
{"║ "," "," ║"},
{"╚═","══","═╝"}},
.cell_width = 2,
.display_width = 2,
};
struct minescheme symbols_doublewidth = {
/* for the vt220.
DEC Special Graphics Character Set:
http://vt100.net/docs/vt220-rm/table2-4.html
Dynamically Redefinable Character Set:
https://vt100.net/docs/vt220-rm/chapter4.html#S4.16 */
.number = {" ",
SGR(BOLD,"1"),
SGR(BOLD,"2"),
SGR(BOLD,"3"),
SGR(BOLD,"4"),
SGR(BOLD,"5"),
SGR(BOLD,"6"),
SGR(BOLD,"7"),
SGR(BOLD,"8")},
.field_closed = "\x61",
.field_flagged = SGR(BOLD,"\033O!"),
.field_question = SGR(BOLD,"?"),
.mine_normal = SGR(BOLD,"*"),
.mine_death = SGR(BOLD,"#"),
.mine_wrongf = SGR(BOLD,"/"),
.mine_wrongq = SGR(BOLD,"\\"),
.emoticons = {":)", ":(", ":D", ":\033No"},
.border = {{"\033#6\x6c","\x71","\x6b"},
{"\033#6\x78"," ","\x78"},
{"\033[?25l\033#6\x74","\x71","\x75"},
{"\033#6\x78"," ","\x78"},
{"\033#6\x6d","\x71","\x6a"}},
.cell_width = 1,
.display_width = 2,
/* NOTE: sending the DRCS makes the VT220 hang for a few seconds. Then
the input buffer will not be cleared to read the minefield afterwards */
.init_seq = "\033P0;1;0;4;1;1{P" /*config for DRCS "P": 7x10,erase-all*/
"??~^^^^/??N????\033\\" /* flag at '!' resembling ▕▀ */
"\033(0\033*B\033+P" /* G0=Graphics,G2=ASCII,G3="P" */
"\x0f" /* invoke G0 (locking shift) */
"\033[?3l", /* disable 132 column mode (DECCOLM) */
.reset_seq = "\033(B" /* reset to DEC Multinational Character Set */
"\033[?3h", /* reenable DECCOLM (WARN: unconditionally!) */
};
#undef SGR
#undef BOLD
#undef BLINK
#undef RED
#undef GREEN
#undef YELLOW
#undef BLUE
#undef CYAN
#undef GREY
#undef BRED
#undef BBLUE
#undef WHITE
#endif