当前位置: 首页>>代码示例>>C++>>正文


C++ InventoryItem::addItem方法代码示例

本文整理汇总了C++中InventoryItem::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ InventoryItem::addItem方法的具体用法?C++ InventoryItem::addItem怎么用?C++ InventoryItem::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InventoryItem的用法示例。


在下文中一共展示了InventoryItem::addItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load

//----------------------------------------------------------------------------//
void InventoryModel::load()
{
    InventoryItem* backpack = InventoryItem::make("Trip backpack", 2.0f, d_root);
    InventoryItem* prev_matryoshka = 0;

    // matryoshka Z to A
    for (char chr = 'Z'; chr >= 'A'; --chr)
    {
        InventoryItem* matryoshka = InventoryItem::make("Matryoshka " + String(1, chr), 1.0f, backpack);

        matryoshka->setIcon("DriveIcons/DriveStack");

        if (prev_matryoshka != 0)
        {
            prev_matryoshka->setParent(matryoshka);
            matryoshka->addItem(prev_matryoshka);
        }

        prev_matryoshka = matryoshka;
    }

    backpack->addItem(InventoryItem::make("Gepäckaufbewahrungsschein: Wiener Neustadt", 1.0f, backpack));
    backpack->addItem(InventoryItem::make("Gepäckaufbewahrungsschein: Frankfurt am Main", 1.0f, backpack));
    backpack->addItem(InventoryItem::make("Gepäckaufbewahrungsschein: Sankt Johann im Pongau", 1.0f, backpack));
    backpack->addItem(InventoryItem::make("Gepäckaufbewahrungsschein: Seekirchen am Wallersee", 1.0f, backpack));

    InventoryItem* beans_can = InventoryItem::make("Beans can", 1.0f, backpack);
    beans_can->setIcon("DriveIcons/GlobalDrive");
    InventoryItem* beans = InventoryItem::make("Beans!", 0.1f, beans_can);
    beans_can->addItem(beans);

    backpack->addItem(prev_matryoshka);
    backpack->addItem(beans_can);

    d_root->addItem(backpack);

    InventoryItem* bow = InventoryItem::make("Bow", 23.451f, d_root);
    for (int i = 25; i >= 0; --i)
    {
        InventoryItem* arrow = InventoryItem::make(
            "arrow " + PropertyHelper<int>::toString(i), 0.2f, bow);
        bow->addItem(arrow);
    }
    d_root->addItem(bow);

    // generate *many* items :D
    for (int i = 2000; i >= 1960; i -= 2)
    {
        InventoryItem* almanach = InventoryItem::make(
            "Almanach " + PropertyHelper<int>::toString(i), 0.34f, d_root);

        if (i % 2 == 0)
            almanach->setIcon("DriveIcons/Lime");

        d_root->addItem(almanach);
    }
}
开发者ID:OpenTechEngine-Libraries,项目名称:CEGUI,代码行数:58,代码来源:InventoryModel.cpp


注:本文中的InventoryItem::addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。