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