本文整理汇总了C++中Pathname::append_path方法的典型用法代码示例。如果您正苦于以下问题:C++ Pathname::append_path方法的具体用法?C++ Pathname::append_path怎么用?C++ Pathname::append_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pathname
的用法示例。
在下文中一共展示了Pathname::append_path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
SpriteAction*
SpriteData::parse_action(const Pathname& dir, FileReader& reader)
{
std::auto_ptr<SpriteAction> action (new SpriteAction);
action->speed = 1.0;
action->scale = 1.0f;
action->offset = Vector2f(0, 0);
reader.get("name", action->name);
reader.get("speed", action->speed);
reader.get("scale", action->scale);
reader.get("offset", action->offset);
FileReader grid_reader;
std::vector<std::string> image_files;
if(reader.get("images", image_files))
{
//parse_images(action.get(), dir, images);
for(std::vector<std::string>::iterator file = image_files.begin(); file != image_files.end(); ++file)
{
Pathname path = dir;
path.append_path(*file);
action->surfaces.push_back(SurfaceManager::current()->get(path));
}
}
else if(reader.get("image-grid", grid_reader))
{
std::string filename;
int x_size = -1;
int y_size = -1;
grid_reader.get("file", filename);
grid_reader.get("x-size", x_size);
grid_reader.get("y-size", y_size);
if(filename.empty() || x_size <= 0 || y_size <= 0)
throw std::runtime_error("Invalid or too few data in image-grid");
Pathname path = dir;
path.append_path(filename);
SurfaceManager::current()->load_grid(path, action->surfaces, x_size, y_size);
}
if(action->name == "")
throw std::runtime_error("No Name defined for action");
if(action->surfaces.size() == 0)
{
std::ostringstream msg;
msg << "Action '" << action->name << "' contains no images";
throw std::runtime_error(msg.str());
}
return action.release();
}