本文整理汇总了C++中Table::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::SetColor方法的具体用法?C++ Table::SetColor怎么用?C++ Table::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void BankPanel::Draw() const
{
Table table;
table.AddColumn(TYPE_X, Table::LEFT);
table.AddColumn(PRINCIPAL_X, Table::LEFT);
table.AddColumn(INTEREST_X, Table::LEFT);
table.AddColumn(TERM_X, Table::LEFT);
table.AddColumn(PAYMENT_X, Table::LEFT);
table.AddColumn(170, Table::RIGHT);
table.SetHighlight(-300, 180);
table.DrawAt(Point(0., FIRST_Y));
Color back = *GameData::Colors().Get("faint");
Color unselected = *GameData::Colors().Get("medium");
Color selected = *GameData::Colors().Get("bright");
table.DrawUnderline(unselected);
table.SetColor(selected);
for(int i = 0; i < 6; ++i)
table.Draw(HEADING[i]);
table.DrawGap(5);
// Figure out the total payments and principal (other than salaries). This
// is in case there are more mortgages than can be displayed.
int otherPrincipal = 0;
int otherPayment = 0;
for(const Mortgage &mortgage : player.Accounts().Mortgages())
{
otherPrincipal += mortgage.Principal();
otherPayment += mortgage.Payment();
}
int totalPayment = otherPayment;
// Check if salaries need to be drawn.
int salaries = player.Salaries();
int row = 0;
for(const Mortgage &mortgage : player.Accounts().Mortgages())
{
if(row == selectedRow)
{
table.DrawHighlight(back);
table.SetColor(selected);
}
else
table.SetColor(unselected);
// There is room for seven rows if including salaries, or 8 if not.
if(row == (6 + !salaries) && otherPrincipal != mortgage.Principal())
{
table.Draw("Other", unselected);
table.Draw(otherPrincipal);
table.Advance(2);
table.Draw(otherPayment);
}
else
{
table.Draw(mortgage.Type());
table.Draw(mortgage.Principal());
table.Draw(mortgage.Interest());
table.Draw(mortgage.Term());
table.Draw(mortgage.Payment());
otherPrincipal -= mortgage.Principal();
otherPayment -= mortgage.Payment();
}
table.Draw("[pay extra]");
++row;
// Draw no more than 8 rows, counting the salaries row if any.
if(row == 7 + !salaries)
break;
}
table.SetColor(unselected);
// Draw the salaries, if necessary.
if(salaries)
{
totalPayment += salaries;
table.Draw("Crew Salaries", unselected);
table.Advance(3);
table.Draw(salaries);
table.Advance();
}
table.Advance(3);
table.Draw("total:", selected);
table.Draw(totalPayment, unselected);
table.Advance();
table.DrawAt(Point(0., FIRST_Y + 210.));
string credit = "Your credit score is " + to_string(player.Accounts().CreditScore()) + ".";
table.Draw(credit);
table.Advance(5);
string amount;
if(!qualify)
amount = "You do not qualify for further loans at this time.";
else
amount = "You qualify for a new loan of up to " + Format::Number(qualify) + " credits.";
bool isSelected = qualify && (selectedRow > (6 + !salaries)
//.........这里部分代码省略.........