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


C++ CTileBank::computeXRef方法代码示例

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


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

示例1: on_absolutePathPushButton_clicked

void CTile_edit_dlg::on_absolutePathPushButton_clicked()
{
	// Build the struct
    QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly;
    QString directory = QFileDialog::getExistingDirectory(this, tr("Select the absolute base path of the bank"), ui.absolutePathPushButton->text(), options);

	// Select the path
	if (!directory.isEmpty())
	{
		// Convert item into path string
		QString path = QDir::toNativeSeparators(directory);

		// Add a final back slash
		if (!path.endsWith(QDir::separator()))
		{
			// Add a '\' at the end
			path.append(QDir::separator());
		}

		//// Last check
		QMessageBox::StandardButton reply;
		QString confirmMessage = tr("Do you really want to set %1 as base path of the bank?").arg(path);
		reply = QMessageBox::question(this, tr("Confirm Path"), confirmMessage, QMessageBox::Yes | QMessageBox::No);
		if (reply == QMessageBox::Yes)
		{
			// Set as default path..

			// Old path
			const char* oldPath=tileBank.getAbsPath ().c_str();

			// Path are good
			bool goodPath=true;

			// If no absolute path, must check before use it
			if ((*oldPath)==0)
			{
				// Compute xref
				tileBank.computeXRef();

				// For all tiles, check we can change the path
				for (int tiles=0; tiles<tileBank.getTileCount(); tiles++)
				{
					// Get tile xref
					int tileSet;
					int number;
					CTileBank::TTileType type;
					tileBank.getTileXRef (tiles, tileSet, number, type);

					// Is tile used ?
					if (tileSet!=-1)
					{
						// 3 types of bitmaps
						int type;
						for (type=CTile::diffuse; type<CTile::bitmapCount; type++)
						{
							// Bitmap string
							const std::string& bitmapPath=tileBank.getTile(tiles)->getRelativeFileName ((CTile::TBitmap)type);

							// not empty ?
							if (bitmapPath!="")
							{
								// Check the path
								if ( CheckPath( bitmapPath, path.toUtf8() ) == false )
								{
									// Bad path
									goodPath=false;

									// Message
									QString continueMessage = tr("Path '%1' can't be found in bitmap '%2'. Continue ?").arg(path).arg(QString(bitmapPath.c_str()));
									reply = QMessageBox::question(this, tr("Continue"), continueMessage, QMessageBox::Yes | QMessageBox::No);
									if (reply  == QMessageBox::No)
										break;
								}
							}
						}
						if (type!=CTile::bitmapCount)
							break;
					}
				}

				// For all tiles, check we can change the path
				for (uint noise=1; noise<tileBank.getDisplacementMapCount (); noise++)
				{
					// Bitmap string
					const char *bitmapPath=tileBank.getDisplacementMap (noise);

					// not empty ?
					if (strcmp (bitmapPath, "")!=0)
					{
						// Check the path
						if (CheckPath( bitmapPath, path.toUtf8() )==false)
						{
							// Bad path
							goodPath=false;

							// Message
							QString continueMessage = tr("Path '%1' can't be found in bitmap '%2'. Continue ?").arg(path).arg(QString(bitmapPath));
							reply = QMessageBox::question(this, tr("Continue"), continueMessage, QMessageBox::Yes | QMessageBox::No);
							if (reply  == QMessageBox::No)
								break;
//.........这里部分代码省略.........
开发者ID:AzyxWare,项目名称:ryzom,代码行数:101,代码来源:tile_edit_dlg.cpp


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