mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 10:50:58 +00:00
[qwaq] Add mvwaddch and ACS support
This commit is contained in:
parent
a0c4d56668
commit
b9ab30ff59
3 changed files with 116 additions and 0 deletions
|
@ -103,11 +103,13 @@ void destroy_window (window_t win) = #0;
|
|||
void mvwprintf (window_t win, int x, int y, string fmt, ...) = #0;
|
||||
void wprintf (window_t win, string fmt, ...) = #0;
|
||||
void wrefresh (window_t win) = #0;
|
||||
void mvwaddch (window_t win, int x, int y, int ch) = #0;
|
||||
int get_event (qwaq_event_t *event) = #0;
|
||||
int max_colors (void) = #0;
|
||||
int max_color_pairs (void) = #0;
|
||||
int init_pair (int pair, int f, int b) = #0;
|
||||
void wbkgd (window_t win, int ch) = #0;
|
||||
int acs_char (int acs) = #0;
|
||||
|
||||
panel_t create_panel (window_t window) = #0;
|
||||
void destroy_panel (panel_t panel) = #0;
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef enum qwaq_commands_e {
|
|||
qwaq_cmd_doupdate,
|
||||
qwaq_cmd_mvwaddstr,
|
||||
qwaq_cmd_waddstr,
|
||||
qwaq_cmd_mvwaddch,
|
||||
qwaq_cmd_wrefresh,
|
||||
qwaq_cmd_init_pair,
|
||||
qwaq_cmd_wbkgd,
|
||||
|
@ -481,6 +482,18 @@ cmd_waddstr (qwaq_resources_t *res)
|
|||
release_string (res, string_id);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_mvwaddch (qwaq_resources_t *res)
|
||||
{
|
||||
int window_id = RB_PEEK_DATA (res->command_queue, 2);
|
||||
int x = RB_PEEK_DATA (res->command_queue, 3);
|
||||
int y = RB_PEEK_DATA (res->command_queue, 4);
|
||||
int ch = RB_PEEK_DATA (res->command_queue, 5);
|
||||
|
||||
window_t *window = get_window (res, __FUNCTION__, window_id);
|
||||
mvwaddch (window->win, y, x, ch);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_wrefresh (qwaq_resources_t *res)
|
||||
{
|
||||
|
@ -560,6 +573,9 @@ process_commands (qwaq_resources_t *res)
|
|||
case qwaq_cmd_waddstr:
|
||||
cmd_waddstr (res);
|
||||
break;
|
||||
case qwaq_cmd_mvwaddch:
|
||||
cmd_mvwaddch (res);
|
||||
break;
|
||||
case qwaq_cmd_wrefresh:
|
||||
cmd_wrefresh (res);
|
||||
break;
|
||||
|
@ -865,6 +881,25 @@ bi_wprintf (progs_t *pr)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bi_mvwaddch (progs_t *pr)
|
||||
{
|
||||
qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq");
|
||||
int window_id = P_INT (pr, 0);
|
||||
int x = P_INT (pr, 1);
|
||||
int y = P_INT (pr, 2);
|
||||
int ch = P_INT (pr, 3);
|
||||
|
||||
if (get_window (res, __FUNCTION__, window_id)) {
|
||||
int command[] = {
|
||||
qwaq_cmd_mvwaddch, 0,
|
||||
window_id, x, y, ch
|
||||
};
|
||||
command[1] = CMD_SIZE(command);
|
||||
qwaq_submit_command (res, command);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bi_wrefresh (progs_t *pr)
|
||||
{
|
||||
|
@ -925,7 +960,20 @@ bi_wbkgd (progs_t *pr)
|
|||
int command[] = { qwaq_cmd_wbkgd, 0, window_id, ch, };
|
||||
command[1] = CMD_SIZE(command);
|
||||
qwaq_submit_command (res, command);
|
||||
}
|
||||
}
|
||||
|
||||
static const char qwaq_acs_char_map[] = "lmkjtuvwqxnos`afg~,+.-hi0pryz{|}";
|
||||
static void
|
||||
bi_acs_char (progs_t *pr)
|
||||
{
|
||||
unsigned acs = P_INT (pr, 0);
|
||||
if (acs < 256) {
|
||||
R_INT (pr) = NCURSES_ACS(acs);
|
||||
} else if (acs - 256 < sizeof (qwaq_acs_char_map)) {
|
||||
R_INT (pr) = NCURSES_ACS(qwaq_acs_char_map[acs - 256]);
|
||||
} else {
|
||||
R_INT (pr) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -981,12 +1029,14 @@ static builtin_t builtins[] = {
|
|||
{"doupdate", bi_doupdate, -1},
|
||||
{"mvwprintf", bi_mvwprintf, -1},
|
||||
{"wprintf", bi_wprintf, -1},
|
||||
{"mvwaddch", bi_mvwaddch, -1},
|
||||
{"wrefresh", bi_wrefresh, -1},
|
||||
{"get_event", bi_get_event, -1},
|
||||
{"max_colors", bi_max_colors, -1},
|
||||
{"max_color_pairs", bi_max_color_pairs, -1},
|
||||
{"init_pair", bi_init_pair, -1},
|
||||
{"wbkgd", bi_wbkgd, -1},
|
||||
{"acs_char", bi_acs_char, -1},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,67 @@
|
|||
#include "event.h"
|
||||
|
||||
#ifdef __QFCC__
|
||||
// names, order and comments lifted from ncurses.h
|
||||
typedef enum {
|
||||
/* VT100 symbols begin here */
|
||||
ACS_ULCORNER = 256, /* upper left corner */
|
||||
ACS_LLCORNER, /* lower left corner */
|
||||
ACS_URCORNER, /* upper right corner */
|
||||
ACS_LRCORNER, /* lower right corner */
|
||||
ACS_LTEE, /* tee pointing right */
|
||||
ACS_RTEE, /* tee pointing left */
|
||||
ACS_BTEE, /* tee pointing up */
|
||||
ACS_TTEE, /* tee pointing down */
|
||||
ACS_HLINE, /* horizontal line */
|
||||
ACS_VLINE, /* vertical line */
|
||||
ACS_PLUS, /* large plus or crossover */
|
||||
ACS_S1, /* scan line 1 */
|
||||
ACS_S9, /* scan line 9 */
|
||||
ACS_DIAMOND, /* diamond */
|
||||
ACS_CKBOARD, /* checker board (stipple) */
|
||||
ACS_DEGREE, /* degree symbol */
|
||||
ACS_PLMINUS, /* plus/minus */
|
||||
ACS_BULLET, /* bullet */
|
||||
/* Teletype 5410v1 symbols begin here */
|
||||
ACS_LARROW, /* arrow pointing left */
|
||||
ACS_RARROW, /* arrow pointing right */
|
||||
ACS_DARROW, /* arrow pointing down */
|
||||
ACS_UARROW, /* arrow pointing up */
|
||||
ACS_BOARD, /* board of squares */
|
||||
ACS_LANTERN, /* lantern symbol */
|
||||
ACS_BLOCK, /* solid square block */
|
||||
/*
|
||||
* These aren't documented, but a lot of System Vs have them anyway
|
||||
* (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
|
||||
* The ACS_names may not match AT&T's, our source didn't know them.
|
||||
*/
|
||||
ACS_S3, /* scan line 3 */
|
||||
ACS_S7, /* scan line 7 */
|
||||
ACS_LEQUAL, /* less/equal */
|
||||
ACS_GEQUAL, /* greater/equal */
|
||||
ACS_PI, /* Pi */
|
||||
ACS_NEQUAL, /* not equal */
|
||||
ACS_STERLING, /* UK pound sign */
|
||||
|
||||
/*
|
||||
* Line drawing ACS names are of the form ACS_trbl, where t is the top, r
|
||||
* is the right, b is the bottom, and l is the left. t, r, b, and l might
|
||||
* be B (blank), S (single), D (double), or T (thick). The subset defined
|
||||
* here only uses B and S.
|
||||
*/
|
||||
ACS_BSSB = ACS_ULCORNER,
|
||||
ACS_SSBB = ACS_LLCORNER,
|
||||
ACS_BBSS = ACS_URCORNER,
|
||||
ACS_SBBS = ACS_LRCORNER,
|
||||
ACS_SBSS = ACS_RTEE,
|
||||
ACS_SSSB = ACS_LTEE,
|
||||
ACS_SSBS = ACS_BTEE,
|
||||
ACS_BSSS = ACS_TTEE,
|
||||
ACS_BSBS = ACS_HLINE,
|
||||
ACS_SBSB = ACS_VLINE,
|
||||
ACS_SSSS = ACS_PLUS,
|
||||
} qwaq_acs_chars;
|
||||
|
||||
typedef struct window_s *window_t;
|
||||
typedef struct panel_s *panel_t;
|
||||
|
||||
|
@ -15,6 +76,7 @@ typedef struct panel_s *panel_t;
|
|||
@extern void mvwprintf (window_t win, int x, int y, string fmt, ...);
|
||||
@extern void wprintf (window_t win, string fmt, ...);
|
||||
@extern void wrefresh (window_t win);
|
||||
@extern void mvwaddch (window_t win, int x, int y, int ch);
|
||||
|
||||
@extern panel_t create_panel (window_t window);
|
||||
@extern void destroy_panel (panel_t panel);
|
||||
|
@ -32,6 +94,8 @@ typedef struct panel_s *panel_t;
|
|||
@extern int max_color_pairs (void);
|
||||
@extern int init_pair (int pair, int f, int b);
|
||||
@extern void wbkgd (window_t win, int ch);
|
||||
|
||||
@extern int acs_char (int acs);
|
||||
#endif
|
||||
|
||||
#endif//__qwaq_curses_h
|
||||
|
|
Loading…
Reference in a new issue