Rev 4541 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4541 | Rev 4644 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | 60 | ||
61 | static cell curscreen[B_SIZE]; /* non-zero => standout (or otherwise marked) */ |
61 | static cell curscreen[B_SIZE]; /* non-zero => standout (or otherwise marked) */ |
62 | static int curscore; |
62 | static int curscore; |
63 | static int isset; /* true => terminal is in game mode */ |
63 | static int isset; /* true => terminal is in game mode */ |
64 | 64 | ||
- | 65 | static int use_color; /* true => use colors */ |
|
- | 66 | ||
65 | static const struct shape *lastshape; |
67 | static const struct shape *lastshape; |
66 | 68 | ||
67 | 69 | ||
68 | /* |
70 | /* |
69 | * putstr() is for unpadded strings (either as in termcap(5) or |
71 | * putstr() is for unpadded strings (either as in termcap(5) or |
Line 76... | Line 78... | ||
76 | } |
78 | } |
77 | 79 | ||
78 | static void start_standout(uint32_t color) |
80 | static void start_standout(uint32_t color) |
79 | { |
81 | { |
80 | fflush(stdout); |
82 | fflush(stdout); |
81 | console_set_rgb_color(fphone(stdout), 0xf0f0f0, color); |
83 | console_set_rgb_color(fphone(stdout), 0xf0f0f0, |
- | 84 | use_color ? color : 0x000000); |
|
82 | } |
85 | } |
83 | 86 | ||
84 | static void resume_normal(void) |
87 | static void resume_normal(void) |
85 | { |
88 | { |
86 | fflush(stdout); |
89 | fflush(stdout); |
Line 125... | Line 128... | ||
125 | static int get_display_size(winsize_t *ws) |
128 | static int get_display_size(winsize_t *ws) |
126 | { |
129 | { |
127 | return console_get_size(fphone(stdout), &ws->ws_col, &ws->ws_row); |
130 | return console_get_size(fphone(stdout), &ws->ws_col, &ws->ws_row); |
128 | } |
131 | } |
129 | 132 | ||
- | 133 | static int get_display_color_sup(void) |
|
- | 134 | { |
|
- | 135 | int rc; |
|
- | 136 | int ccap; |
|
- | 137 | ||
- | 138 | rc = console_get_color_cap(fphone(stdout), &ccap); |
|
- | 139 | if (rc != 0) |
|
- | 140 | return 0; |
|
- | 141 | ||
- | 142 | return (ccap >= CONSOLE_CCAP_RGB); |
|
- | 143 | } |
|
- | 144 | ||
130 | /* |
145 | /* |
131 | * Set up screen mode. |
146 | * Set up screen mode. |
132 | */ |
147 | */ |
133 | void scr_set(void) |
148 | void scr_set(void) |
134 | { |
149 | { |
Line 139... | Line 154... | ||
139 | 154 | ||
140 | if (get_display_size(&ws) == 0) { |
155 | if (get_display_size(&ws) == 0) { |
141 | Rows = ws.ws_row; |
156 | Rows = ws.ws_row; |
142 | Cols = ws.ws_col; |
157 | Cols = ws.ws_col; |
143 | } |
158 | } |
- | 159 | ||
- | 160 | use_color = get_display_color_sup(); |
|
144 | 161 | ||
145 | if ((Rows < MINROWS) || (Cols < MINCOLS)) { |
162 | if ((Rows < MINROWS) || (Cols < MINCOLS)) { |
146 | char smallscr[55]; |
163 | char smallscr[55]; |
147 | 164 | ||
148 | snprintf(smallscr, sizeof(smallscr), |
165 | snprintf(smallscr, sizeof(smallscr), |