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


C++ Solid::UseModel方法代码示例

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


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

示例1: new

void
Weapon::SetOwner(Ship* s)
{
    ship = s;

    if (design->turret_model) {
        Solid* t = new(__FILE__,__LINE__) Solid;
        t->UseModel(design->turret_model);
        turret = t;
    }

    if (design->turret_base_model) {
        Solid* t = new(__FILE__,__LINE__) Solid;
        t->UseModel(design->turret_base_model);
        turret_base = t;
    }

    if (!design->primary          && 
            design->visible_stores   &&
            ammo == nbarrels         &&
            design->shot_model != 0)
    {
        for (int i = 0; i < nbarrels; i++) {
            Solid* s = new(__FILE__,__LINE__) Solid;
            s->UseModel(design->shot_model);

            visible_stores[i] = s;
        }
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:30,代码来源:Weapon.cpp

示例2: UpdateCamera

void
TacRefDlg::SelectShip(const ShipDesign* design)
{
    if (beauty && camview) {
        scene.Graphics().clear();

        if (design) {
            radius = design->radius;

            UpdateCamera();

            int level = design->lod_levels-1;
            int n     = design->models[level].size();

            for (int i = 0; i < n; i++) {
                Model* model = design->models[level].at(i);

                Solid* s = new(__FILE__,__LINE__) Solid;
                s->UseModel(model);
                s->CreateShadows(1);
                s->MoveTo(*design->offsets[level].at(i));

                scene.Graphics().append(s);
            }
        }
    }

    if (txt_caption) {
        txt_caption->SetText("");

        if (design) {
            char txt[256];
            sprintf_s(txt, "%s %s", design->abrv, design->DisplayName());
            txt_caption->SetText(txt);
        }
    }

    if (txt_stats) {
        txt_stats->SetText("");

        if (design) {
            Text desc;
            char txt[256];

            sprintf_s(txt, "%s\t\t\t%s\n", Game::GetText("tacref.type").data(), Ship::ClassName(design->type));
            desc += txt;

            sprintf_s(txt, "%s\t\t\t%s\n", Game::GetText("tacref.class").data(), design->DisplayName());
            desc += txt;
            desc += Game::GetText("tacref.length");
            desc += "\t\t";

            if (design->type < Ship::STATION)
            FormatNumber(txt, design->radius/2);
            else
            FormatNumber(txt, design->radius*2);

            strcat_s(txt, " m\n");
            desc += txt;
            desc += Game::GetText("tacref.mass");
            desc += "\t\t\t";

            FormatNumber(txt, design->mass);
            strcat_s(txt, " T\n");
            desc += txt;
            desc += Game::GetText("tacref.hull");
            desc += "\t\t\t";

            FormatNumber(txt, design->integrity);
            strcat_s(txt, "\n");
            desc += txt;

            if (design->weapons.size()) {
                desc += Game::GetText("tacref.weapons");

                WepGroup groups[8];
                for (int w = 0; w < design->weapons.size(); w++) {
                    Weapon*     gun   = design->weapons[w];
                    WepGroup*   group = FindWepGroup(groups, gun->Group());

                    if (group)
                    group->count++;
                }

                for (int g = 0; g < 8; g++) {
                    WepGroup* group = &groups[g];
                    if (group && group->count) {
                        sprintf_s(txt, "\t\t%s (%d)\n\t\t", group->name.data(), group->count);
                        desc += txt;

                        for (int w = 0; w < design->weapons.size(); w++) {
                            Weapon* gun = design->weapons[w];

                            if (group->name == gun->Group()) {
                                sprintf_s(txt, "\t\t\t%s\n\t\t", (const char*) gun->Design()->name);
                                desc += txt;
                            }
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:Banbury,项目名称:starshatter-open,代码行数:101,代码来源:TacRefDlg.cpp


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