Skip to content

Instantly share code, notes, and snippets.

@KartikShrivastava
Last active June 21, 2022 07:04
Show Gist options
  • Save KartikShrivastava/e76bdb3bf6a7ff564f9003dbb05c2d3d to your computer and use it in GitHub Desktop.
Save KartikShrivastava/e76bdb3bf6a7ff564f9003dbb05c2d3d to your computer and use it in GitHub Desktop.
virtual bool for_each(pugi::xml_node& node) {
for(pugi::xml_attribute attr : node.attributes()) {
if(strcmp(node.name(),"tileset") == 0){
if(strcmp(attr.name(),"tilewidth") == 0)
background->set_tile_width(std::stoi(attr.value()));
else if(strcmp(attr.name(),"tileheight") == 0)
background->set_tile_height(std::stoi(attr.value()));
// truncated code ...
}
// truncated code ...
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment