Exemplo n.º 1
0
void PlayerAi::PrintAttributeOnCharacterSheet(TCODConsole &con, Attribute *currAttr, int32_t baseRow, int32_t baseColumn)
{
	con.setDefaultForeground(TCODColor::white);
	con.print(baseColumn, baseRow, "%s:", currAttr->GetName());
	if (currAttr->GetCurrValue() > currAttr->GetBaseValue()) {
		con.setDefaultForeground(TCODColor::green);
	} else if (currAttr->GetCurrValue() < currAttr->GetBaseValue()) {
		con.setDefaultForeground(TCODColor::red);
	}
	con.print(baseColumn + 15, baseRow, "%3d", currAttr->GetCurrValue());
	con.setDefaultForeground(TCODColor::white);
}
Exemplo n.º 2
0
void g_debugmsg(const char *mes, ...)
{
    int x = 0;
    int y = 3;
    va_list ap;
    va_start(ap, mes);
    char buff[2048];
    vsprintf(buff, mes, ap);
    va_end(ap);
    x = strlen(buff)+8; // +7 because of added DEBUG: tag
    if (x < 29) x = 29;
    TCODConsole *bugger = new TCODConsole(x, y); // should this stay preserved in GAME object?
    bugger->setAlignment(TCOD_LEFT);
    TCODConsole::setColorControl(TCOD_COLCTRL_1,TCODColor::red,TCODColor::black);
    TCODConsole::setColorControl(TCOD_COLCTRL_2,TCODColor::yellow,TCODColor::black);
    std::cout << "DEBUG: " << buff << std::endl;
    bugger->print(0,0, "%cDEBUG: %c%c%s%c", TCOD_COLCTRL_1,TCOD_COLCTRL_STOP,TCOD_COLCTRL_2, buff, TCOD_COLCTRL_STOP);
    bugger->print(0,2, "<Press a key to continue...>");
    TCODConsole::blit(bugger,0,0,x,3,TCODConsole::root, 5, 5);
    TCODConsole::flush();
    TCODConsole::waitForKeypress(true);
    delete bugger;
}