62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
#ifndef MR4TH_NCURSES_H
|
|
#define MR4TH_NCURSES_H
|
|
|
|
#include <ncurses.h>
|
|
|
|
/******************************************************************************
|
|
* NCRS Types *
|
|
******************************************************************************/
|
|
|
|
#define NCRS_ColorPair_XList(X)\
|
|
X(WHITE, BLACK) \
|
|
X(RED, BLACK) \
|
|
X(GREEN, BLACK) \
|
|
X(BLUE, BLACK) \
|
|
X(YELLOW, BLACK) \
|
|
X(MAGENTA, BLACK) \
|
|
X(CYAN, BLACK) \
|
|
X(BLACK, WHITE) \
|
|
X(BLACK, RED) \
|
|
X(BLACK, GREEN) \
|
|
X(BLACK, BLUE) \
|
|
X(BLACK, YELLOW) \
|
|
X(BLACK, MAGENTA) \
|
|
X(BLACK, CYAN)
|
|
|
|
typedef enum NCRS_ColorPair{
|
|
NCRS_ColorPair_NULL = 0,
|
|
|
|
#define X(F,B) NCRS_ColorPair_##F##_##B,
|
|
NCRS_ColorPair_XList(X)
|
|
#undef X
|
|
|
|
NCRS_ColorPair_COUNT
|
|
} NCRS_ColorPair;
|
|
|
|
typedef struct NCRS_Bfr{
|
|
U32 w;
|
|
U32 h;
|
|
U8 *chr;
|
|
U8 *color;
|
|
|
|
RectS32 clip;
|
|
} NCRS_Bfr;
|
|
|
|
/******************************************************************************
|
|
* NCRS Functions *
|
|
******************************************************************************/
|
|
|
|
MR4TH_SYMBOL NCRS_Bfr ncrs_bfr_alloc(Arena *arena, U32 w, U32 h);
|
|
|
|
MR4TH_SYMBOL void ncrs_bfr_clip_clear(NCRS_Bfr *bfr);
|
|
MR4TH_SYMBOL void ncrs_bfr_clip(NCRS_Bfr *bfr, RectS32 rect);
|
|
|
|
MR4TH_SYMBOL void ncrs_bfr_fill_rect(NCRS_Bfr *bfr, RectS32 rect, U8 chr, U8 color);
|
|
MR4TH_SYMBOL void ncrs_bfr_outline_rect(NCRS_Bfr *bfr, RectS32 rect, U8 chr, U8 color);
|
|
MR4TH_SYMBOL void ncrs_bfr_write(NCRS_Bfr *bfr, S32 x, S32 y, String8 str, U8 color);
|
|
MR4TH_SYMBOL void ncrs_bfr_point(NCRS_Bfr *bfr, S32 x, S32 y, U8 chr, U8 color);
|
|
|
|
MR4TH_SYMBOL void ncrs_bfr_to_window(NCRS_Bfr *bfr, WINDOW *w);
|
|
|
|
#endif //MR4TH_NCURSES_H
|