/* * code to print in the message area and to die horrible deaths (with a message) */ #include "art.h" void fatal(char *m){ fprint(2, "fig: %s\n", m); exits(m); } #define NPREV 512 char prevmsg[NPREV]; Image *msgboxcolor, *black; void lastmsg(void){ Point p; p=string(screen, msgbox.min, black, ZP, font, prevmsg); rectf(screen, Rect(p.x, msgbox.min.y, msgbox.max.x, msgbox.max.y), msgboxcolor); } void msg(char *fmt, ...){ va_list arg; rectf(screen, Rect(msgbox.min.x, msgbox.min.y, msgbox.max.x, msgbox.max.y), msgboxcolor); va_start(arg, fmt); vseprint(prevmsg, prevmsg+sizeof(prevmsg), fmt, arg); va_end(arg); lastmsg(); } void echo(char *m){ Point p; rectf(screen, Rect(echobox.min.x, echobox.min.y, echobox.max.x, echobox.max.y), msgboxcolor); p=string(screen, echobox.min, black, ZP, font, m); rectf(screen, Rect(p.x, echobox.min.y, echobox.max.x, echobox.max.y), msgboxcolor); }