本文整理汇总了C++中inventory::getMoney方法的典型用法代码示例。如果您正苦于以下问题:C++ inventory::getMoney方法的具体用法?C++ inventory::getMoney怎么用?C++ inventory::getMoney使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inventory
的用法示例。
在下文中一共展示了inventory::getMoney方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render_InvMenu
void render::render_InvMenu(inventory& inv, int curPos){
std::vector<std::string> nameList = inv.getNameList(curPos);
clear();
texture.loadFromFile(FRAME_SIDE, ren);
texture.render(ren, 0, 0);
Point offset;
offset.m_x = getmaxx() / 2;
offset.m_y = getmaxy() / 2;
SDL_Color textColor = {0xD8, 0xC6, 0x91};
//Print Title
texture.loadFromRenderedText("INVENTORY", textColor, ren, font_comic50);
texture.render(ren, offset.m_x - texture.getWidth() / 2, 8);
char mString[40];
sprintf(mString, "Money: $%d", inv.getMoney());
texture.loadFromRenderedText(mString, textColor, ren, font_comic16);
texture.render(ren, 300, 560);
for (unsigned int i = 0; i < nameList.size(); i++){
texture.loadFromRenderedText(nameList[i].c_str(), textColor, ren, font_comic16);
texture.render(ren, 20, 100 + i * texture.getHeight());
}
if(!nameList.empty()){
//Print Selected Options
textColor = { 0xF4, 0xF0, 0xDD };
texture.loadFromRenderedText(nameList[0].c_str(), textColor, ren, font_comic16);
texture.render(ren, 20, 100);
textColor = {0xD8, 0xC6, 0x91};
char tmp[100];
//Print Informations
sprintf(tmp, "Name : %s", inv[nameList[0]].item.getName().c_str());
texture.loadFromRenderedText(tmp, textColor, ren, font_comic16);
texture.render(ren, getmaxx() * 0.35, 100);
sprintf(tmp, "Currently Have : %d", inv[nameList[0]].count);
texture.loadFromRenderedText(tmp, textColor, ren, font_comic16);
texture.render(ren, getmaxx() * 0.35, 130);
texture.loadFromRenderedText("Description : ", textColor, ren, font_comic16);
texture.render(ren, 300, 160);
unsigned int xoff = (getmaxx() - 260) / 13;
unsigned int i;
for(i = xoff; inv[nameList[0]].item.getDescription().size() > i; i += xoff){
texture.loadFromRenderedText(inv[nameList[0]].item.getDescription().substr(i - xoff, xoff).c_str(), textColor, ren, font_comic16);
texture.render(ren, getmaxx() * 0.35 + 20, 180 + (i / xoff - 1) * 20);
}
texture.loadFromRenderedText(inv[nameList[0]].item.getDescription().substr(i - xoff, inv[nameList[0]].item.getDescription().size()).c_str(), textColor, ren, font_comic16);
texture.render(ren, getmaxx() * 0.35 + 20, 180 + (i / xoff - 1) * 20);
}
update();
}