term.c 552 Bytes
Newer Older
Tomasz Wlostowski's avatar
Tomasz Wlostowski committed
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
#include <stdio.h>
#include <stdarg.h>

#include "term.h"

void cprintf(int color, const char *fmt, ...)
{
    va_list ap;
    mprintf("\033[0%d;3%dm",color & C_DIM ? 2:1, color&0x7f);
    va_start(ap, fmt);
    vprintf(fmt, ap);
    va_end(ap);
}

void pcprintf(int row, int col, int color, const char *fmt, ...)
{
    va_list ap;
    mprintf("\033[%d;%df", row, col);
    mprintf("\033[0%d;3%dm",color & C_DIM ? 2:1, color&0x7f);
    va_start(ap, fmt);
    vprintf(fmt, ap);
    va_end(ap);
}

void term_clear()
{
    mprintf("\033[2J\033[1;1H");
}