int TCODConsole::printCenterRect(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, const char *fmt, ...) { va_list ap; va_start(ap,fmt); int ret = TCOD_console_print(data,x,y,w,h,flag,CENTER,TCOD_console_vsprint(fmt,ap),true,false); va_end(ap); return ret; }
int TCODConsole::getHeightRect(int x, int y, int w, int h, const char *fmt, ...) { va_list ap; va_start(ap,fmt); int ret = TCOD_console_print_internal(data,x,y,w,h,TCOD_BKGND_NONE,TCOD_LEFT,TCOD_console_vsprint(fmt,ap),true,true); va_end(ap); return ret; }
int TCODConsole::printRectEx(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, ...) { va_list ap; va_start(ap,fmt); int ret = TCOD_console_print_internal(data,x,y,w,h,flag,alignment,TCOD_console_vsprint(fmt,ap),true,false); va_end(ap); return ret; }
int TCODConsole::printRect(int x, int y, int w, int h, const char *fmt, ...) { va_list ap; TCOD_console_data_t *dat=(TCOD_console_data_t *)data; TCOD_IFNOT ( dat != NULL ) return 0; va_start(ap,fmt); int ret = TCOD_console_print_internal(data,x,y,w,h,dat->bkgnd_flag,dat->alignment,TCOD_console_vsprint(fmt,ap),true,false); va_end(ap); return ret; }
void TCODConsole::print(int x, int y, const char *fmt, ...) { va_list ap; TCOD_console_data_t *dat=(TCOD_console_data_t *)data; TCOD_IFNOT ( dat != NULL ) return; va_start(ap,fmt); TCOD_console_print_internal(data,x,y,0,0,dat->bkgnd_flag,dat->alignment, TCOD_console_vsprint(fmt,ap),false,false); va_end(ap); }
void TCODConsole::printFrame(int x,int y,int w,int h, bool empty, TCOD_bkgnd_flag_t flag, const char *fmt , ...) { if ( fmt ) { va_list ap; va_start(ap,fmt); TCOD_console_print_frame(data,x,y,w,h,empty,flag,TCOD_console_vsprint(fmt,ap)); va_end(ap); } else { TCOD_console_print_frame(data,x,y,w,h,empty,flag,NULL); } }
void TCOD_console_print_double_frame(TCOD_console_t con,int x,int y,int w,int h, bool empty, TCOD_bkgnd_flag_t flag, const char *fmt, ...) { TCOD_console_data_t *dat = con ? (TCOD_console_data_t *)con : TCOD_ctx.root; TCOD_console_put_char(con,x,y,TCOD_CHAR_DNW,flag); TCOD_console_put_char(con,x+w-1,y,TCOD_CHAR_DNE,flag); TCOD_console_put_char(con,x,y+h-1,TCOD_CHAR_DSW,flag); TCOD_console_put_char(con,x+w-1,y+h-1,TCOD_CHAR_DSE,flag); TCOD_console_double_hline(con,x+1,y,w-2, flag); TCOD_console_double_hline(con,x+1,y+h-1,w-2, flag); TCOD_console_double_vline(con,x,y+1,h-2, flag); TCOD_console_double_vline(con,x+w-1,y+1,h-2, flag); if ( h > 2 ) { TCOD_console_vline(con,x,y+1,h-2,flag); TCOD_console_vline(con,x+w-1,y+1,h-2,flag); if ( empty ) { TCOD_console_rect(con,x+1,y+1,w-2,h-2,true,flag); } } if (fmt) { va_list ap; int xs; TCOD_color_t tmp; char *title; va_start(ap,fmt); title = TCOD_console_vsprint(fmt,ap); va_end(ap); title[w-3]=0; /* truncate if needed */ xs = x + (w-strlen(title)-2)/2; tmp=dat->back; /* swap colors */ dat->back=dat->fore; dat->fore=tmp; TCOD_console_print_ex(con,xs,y,TCOD_BKGND_SET,TCOD_LEFT," %s ",title); tmp=dat->back; /* swap colors */ dat->back=dat->fore; dat->fore=tmp; } }
void TCODConsole::printEx(int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, ...) { va_list ap; va_start(ap,fmt); TCOD_console_print_internal(data,x,y,0,0,flag,alignment,TCOD_console_vsprint(fmt,ap),false,false); va_end(ap); }
void TCODConsole::printCenter(int x, int y, TCOD_bkgnd_flag_t flag, const char *fmt, ...) { va_list ap; va_start(ap,fmt); TCOD_console_print(data,x,y,getWidth(),getHeight()-y,flag,CENTER,TCOD_console_vsprint(fmt,ap),false,false); va_end(ap); }
void TCODConsole::printRight(int x, int y, TCOD_bkgnd_flag_t flag, const char *fmt, ...) { va_list ap; va_start(ap,fmt); TCOD_console_print(data,x,y,x+1,getHeight()-y,flag,RIGHT,TCOD_console_vsprint(fmt,ap),false,false); va_end(ap); }