Commit 6936cf66 authored by deuce's avatar deuce
Browse files

Add set_vmem() and set_vmem_attr() functions to make it easier to manipulate

a struct vmem_cell.
parent a147cfc9
......@@ -134,6 +134,8 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_restorescreen(struct ciolib_screen *scrn);
CIOLIBEXPORT void CIOLIBCALL ciolib_setcolour(uint32_t fg, uint32_t bg);
CIOLIBEXPORT int CIOLIBCALL ciolib_get_modepalette(uint32_t p[16]);
CIOLIBEXPORT int CIOLIBCALL ciolib_set_modepalette(uint32_t p[16]);
CIOLIBEXPORT void CIOLIBCALL ciolib_set_vmem(struct vmem_cell *cell, uint8_t ch, uint8_t attr, uint8_t font);
CIOLIBEXPORT void CIOLIBCALL ciolib_set_vmem_attr(struct vmem_cell *cell, uint8_t attr);
#if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
int sdl_video_initialized = 0;
......@@ -1999,3 +2001,26 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_checkfont(int fontnum)
return 0;
}
CIOLIBEXPORT void CIOLIBCALL
ciolib_set_vmem(struct vmem_cell *cell, uint8_t ch, uint8_t attr, uint8_t font)
{
CIOLIB_INIT();
if (cell == NULL)
return;
cell->ch = ch;
cell->font = font;
ciolib_set_vmem_attr(cell, attr);
}
CIOLIBEXPORT void CIOLIBCALL
ciolib_set_vmem_attr(struct vmem_cell *cell, uint8_t attr)
{
CIOLIB_INIT();
if (cell == NULL)
return;
cell->legacy_attr = attr;
ciolib_attr2palette(attr, &cell->fg, &cell->bg);
}
......
......@@ -452,6 +452,8 @@ CIOLIBEXPORT uint32_t CIOLIBCALL ciolib_map_rgb(uint16_t r, uint16_t g, uint16_t
CIOLIBEXPORT void CIOLIBCALL ciolib_replace_font(uint8_t id, char *name, void *data, size_t size);
CIOLIBEXPORT int CIOLIBCALL ciolib_attrfont(uint8_t attr);
CIOLIBEXPORT int CIOLIBCALL ciolib_checkfont(int font_num);
CIOLIBEXPORT void CIOLIBCALL ciolib_set_vmem(struct vmem_cell *cell, uint8_t ch, uint8_t attr, uint8_t font);
CIOLIBEXPORT void CIOLIBCALL ciolib_set_vmem_attr(struct vmem_cell *cell, uint8_t attr);
/* DoorWay specific stuff that's only applicable to ANSI mode. */
CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
......@@ -531,6 +533,8 @@ CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
#define replace_font(a,b,c,d) ciolib_replace_font(a,b,c,d)
#define attrfont(a) ciolib_attrfont(a)
#define checkfont(a) ciolib_checkfont(a)
#define set_vmem(a, b, c, d) ciolib_set_vmem(a, b, c, d)
#define set_vmem_attr(a, b) ciolib_set_vmem_attr(a, b)
#endif
#ifdef WITH_SDL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment