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


C++ Place::addVertex方法代码示例

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


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

示例1: loadXml

bool Oca::loadXml(string _xmlConfigFile){
    bool loaded = false;

    ofxXmlSettings XML;

    if (XML.loadFile(_xmlConfigFile)){
        places.clear();
        players.clear();

        //  Places ( casilleros )
        //
        int totalPatchs = XML.getNumTags("place");

        for(int i = 0; i < totalPatchs ; i++){
            XML.pushTag("place", i);

            Place *newPlace = new Place( XML.getValue("id", -1) );

            newPlace->angle = XML.getValue("angle", 0.0);
            newPlace->message = XML.getValue("message", "NULL");

            // Load the mask path
            if ( XML.pushTag("mask") ){
                int totalMaskCorners = XML.getNumTags("point");
                if (totalMaskCorners > 0){
                    newPlace->clear();
                }

                for(int i = 0; i < totalMaskCorners; i++){
                    XML.pushTag("point",i);
                    newPlace->addVertex( space.x + XML.getValue("x", 0.0) * space.width, space.y + XML.getValue("y", 0.0)*space.height);
                    XML.popTag();
                }
                XML.popTag(); // Pop "mask"
            }

            newPlace->scale = scaleFactor;
            newPlace->bLoop = XML.getValue("loop", false);
            newPlace->lockUntil = XML.getValue("lock", -1);

            if ( XML.tagExists("link")){
                if ( XML.pushTag("link") ){
                    int totalLinks = XML.getNumTags("id");

                    for(int i = 0; i < totalLinks; i++){
                        int linkId = XML.getValue("id", i);
                        newPlace->linked.push_back(linkId);

                    }
                    XML.popTag(); // Pop "link"
                }
            }

            newPlace->setImage( XML.getValue("baseImage", "00.png") );
            newPlace->bColored = XML.getValue("colored", false);

            places.push_back(newPlace);

            XML.popTag();   // Pop "place"
        }

        //  Players ( fichas )
        //
        int totalPlayer = XML.getNumTags("player");
        for(int i = 0; i < totalPlayer ; i++){
            XML.pushTag("player", i);

            Player newPlayer = Player(i);

            newPlayer.x = XML.getValue("pos:x", 0.0);
            newPlayer.y = XML.getValue("pos:y", 0.0);

            newPlayer.color.set(XML.getValue("color:r", 255),
                                XML.getValue("color:g", 255),
                                XML.getValue("color:b", 255),
                                100);

            newPlayer.img.loadImage( XML.getValue("image", "player01.png")  );

            players.push_back(newPlayer);

            XML.popTag();   // Pop "player"
        }
        for (int i = 0; i < players.size(); i++){
            ofAddListener( players[i].arriveToPlace, this, &Oca::playerArriveToPlace);
        }
    } else
        ofLog(OF_LOG_ERROR,"Oca: loading file " + _xmlConfigFile );

    return loaded;
}
开发者ID:patriciogonzalezvivo,项目名称:mesaDelTiempo,代码行数:91,代码来源:Oca.cpp


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