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


C++ CTileBank类代码示例

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


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

示例1: main

int main(int argc, char* argv[])
{
	// Arg ?
	if (argc<3)
	{
		// Doc
		printf ("build_smallbank [input.bank] [output.smallbank] [new_absolute_path]\n");
	}
	else
	{
		try
		{
			// Load the bank
			CTileBank bank;

			// Input file
			CIFile input;
			if (input.open (argv[1]))
			{
				// Serial the bank
				bank.serial (input);

				// Make a small bank
				bank.cleanUnusedData ();

				// Absolute path ?
				if (argc>3)
					bank.setAbsPath (argv[3]);

				// Output file
				COFile output;
				if (output.open (argv[2]))
				{
					// Serial the bank
					bank.serial (output);
				}
				else
				{
					// Error
					nlwarning ("ERROR can't open the file %s for writing", argv[2]);
				}
			}
			else
			{
				// Error
				nlwarning ("ERROR can't open the file %s for reading", argv[1]);
			}

		}
		catch (const Exception& e)
		{
			// Error
			nlwarning ("ERROR fatal error: %s", e.what());
		}
	}
	return 0;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:57,代码来源:build_smallbank.cpp

示例2: CTextureMem

CBankCont::CBankCont (CTileBank& bank, HINSTANCE hInstance)
{
	// Allocate bitmaps
	_smallBitmap	=	new CTextureMem ((uint8*)_small, _smallSize, false);
	mediumBitmap	=	new CTextureMem ((uint8*)medium, mediumSize, false);
	largeBitmap		=	new CTextureMem ((uint8*)large, largeSize, false);
	_256Bitmap		=	new CTextureMem ((uint8*)_256, _256Size, false);
	_128Bitmap		=	new CTextureMem ((uint8*)_128, _128Size, false);
	_0Bitmap		=	new CTextureMem ((uint8*)_0, _0Size, false);
	_1Bitmap		=	new CTextureMem ((uint8*)_1, _1Size, false);
	_2Bitmap		=	new CTextureMem ((uint8*)_2, _2Size, false);
	_3Bitmap		=	new CTextureMem ((uint8*)_3, _3Size, false);
	_4Bitmap		=	new CTextureMem ((uint8*)_4, _4Size, false);
	_5Bitmap		=	new CTextureMem ((uint8*)_5, _5Size, false);
	_6Bitmap		=	new CTextureMem ((uint8*)_6, _6Size, false);
	_7Bitmap		=	new CTextureMem ((uint8*)_7, _7Size, false);
	_8Bitmap		=	new CTextureMem ((uint8*)_8, _8Size, false);
	_9Bitmap		=	new CTextureMem ((uint8*)_9, _9Size, false);
	_10Bitmap		=	new CTextureMem ((uint8*)_10, _10Size, false);
	_11Bitmap		=	new CTextureMem ((uint8*)_11, _11Size, false);
	allBitmap		=	new CTextureMem ((uint8*)all, allSize, false);
	lightBitmap		=	new CTextureMem ((uint8*)light, lightSize, false);
	lockBitmap		=	new CTextureMem ((uint8*)lock, lockSize, false);
	orientedBitmap	=	new CTextureMem ((uint8*)oriented, orientedSize, false);
	nothingBitmap	=	new CTextureMem ((uint8*)nothing, nothingSize, false);
	regularBitmap	=	new CTextureMem ((uint8*)regular, regularSize, false);
	goofyBitmap		=	new CTextureMem ((uint8*)goofy, goofySize, false);

	// Resize the tileset array
	TileSet.resize (bank.getTileSetCount());

	// For each tileSet, build the cont
	for (int tileSet=0; tileSet<bank.getTileSetCount(); tileSet++)
		TileSet[tileSet].build (bank, tileSet);

	// Load cursors
	HInspect = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_INSPECT));
	HCur = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_PICK_COLOR));
	HFill = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_FILL));
	HTrick = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_TRICK));
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:41,代码来源:paint_ui.cpp

示例3: on_tileSetListWidget_itemSelectionChanged

void CTile_edit_dlg::on_tileSetListWidget_itemSelectionChanged()
{
	tileSetSelectionChanging = true;

	int nindex = ui.tileSetListWidget->currentRow();
	if (nindex != -1) 
	{
		if ( !tileBank.getTileSet(nindex)->getTileVegetableDescFileName().empty() )
			ui.chooseVegetPushButton->setText( QString( tileBank.getTileSet(nindex)->getTileVegetableDescFileName().c_str() ) );
		else
			ui.chooseVegetPushButton->setText("...");

		ui.surfaceDataLineEdit->setText( QString::number( tileBank.getTileSet(nindex)->SurfaceData) );
		ui.orientedCheckBox->setChecked( tileBank.getTileSet(nindex)->getOriented() );
		
		ui.selectedTileSetGroupBox->setEnabled(true);
		ui.editTileSetPushButton->setEnabled(true);
		ui.deleteTileSetPushButton->setEnabled(true);
	}
	else
	{
		//TODO titegus: Init DetailFrame Method
		ui.chooseVegetPushButton->setText("...");
		ui.surfaceDataLineEdit->clear();
		ui.orientedCheckBox->setChecked(false);

		ui.selectedTileSetGroupBox->setEnabled(false);
		ui.editTileSetPushButton->setEnabled(false);
		ui.deleteTileSetPushButton->setEnabled(false);
	}

	tileSetSelectionChanging = false;
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:33,代码来源:tile_edit_dlg.cpp

示例4: Flags

void Browse::Flags (int flagNumber, bool go)
{
	// For each 
	for (int i=0;i<m_ctrl.InfoList.GetSize(m_128x128);i++)
	{
		// Selected ?
		if (m_ctrl.InfoList.theList[m_128x128][i].Selected)
		{
			// Tile index
			sint index;

			// get flags
			switch (m_128x128)
			{
			case 0:
				// Tile index
				index=tileBank2.getTileSet (land)->getTile128 (i);
				break;
			case 1:
				// Tile index
				index=tileBank2.getTileSet (land)->getTile256 (i);
				break;
			case 2:
				// Tile index
				index=tileBank2.getTileSet (land)->getTransition (i)->getTile ();
				break;
			default:
				nlassert (0);	// no!
			}

			// valid flags
			if (index!=-1)
			{
				// Get flags
				uint value=tileBank2.getTile (index)->getGroupFlags ();

				// Clear flag
				value&=~(1<<flagNumber);

				// Set the flag
				if (go)
					value|=(1<<flagNumber);

				// Setup
				tileBank2.getTile (index)->setGroupFlags (value);
			}
		}
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:49,代码来源:Browse.cpp

示例5: on_deleteTileSetPushButton_clicked

void CTile_edit_dlg::on_deleteTileSetPushButton_clicked()
{
	int nindex = ui.tileSetListWidget->currentRow();
	if (nindex != -1) 
	{

		//WORKAROUND : Qt 4.4 Behaviour (when removing at row 0 and currentRow equals to 0, currentRow is set to 1, it mess with the selectionChanged event
		if (nindex == 0)
		{
			if ( ui.tileSetListWidget->count() > 1)
				ui.tileSetListWidget->setCurrentRow(1);
			else
				ui.tileSetListWidget->setCurrentRow(-1);
		}
		//

		tileBank.removeTileSet( nindex );

		QListWidgetItem* item = ui.tileSetListWidget->takeItem(nindex);
		delete item;
	}
	else
	{
		QMessageBox::information( this, tr("No Tile Set Selected"), tr("Please, select a Tile Set to delete first ...") );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:26,代码来源:tile_edit_dlg.cpp

示例6: on_saveAsPushButton_clicked

void CTile_edit_dlg::on_saveAsPushButton_clicked()
{
	QFileDialog::Options options;
	QString selectedFilter;
	QString fileName = QFileDialog::getSaveFileName(this, tr("Save Bank"), this->mainFile.absoluteFilePath(), tr("NeL tile bank files (*.bank);;All Files (*.*);;"), &selectedFilter, options);
	if (!fileName.isEmpty())
	{
		// Set MainFile
		mainFile = QFileInfo(fileName);
		ui.savePushButton->setEnabled(true);


		string fullPath = this->mainFile.absoluteFilePath().toUtf8();
		if ( !fullPath.empty() )
		{
			COFile stream;
			if ( stream.open( fullPath.c_str() ) )
			{
				tileBank.serial (stream);
				QString s = tr("Bank %1 saved").arg( QString( fullPath.c_str() ) );
				QMessageBox::information(this, tr("Bank Saved"), s);
				return;
			}
		}

		QMessageBox::information(this, tr("Error"), tr("Can't Save Bank, check the path"));

	}

}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:30,代码来源:tile_edit_dlg.cpp

示例7: on_resetVegetPushButton_clicked

void CTile_edit_dlg::on_resetVegetPushButton_clicked()
{
	int nindex = ui.tileSetListWidget->currentRow();
	if (nindex != -1) 
	{
		tileBank.getTileSet (nindex)->setTileVegetableDescFileName ("");
		ui.chooseVegetPushButton->setText("...");
	}
	else
	{
		QMessageBox::information( this, tr("No Tile Set Selected"), tr("Please, select a Tile Set first ...") );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:13,代码来源:tile_edit_dlg.cpp

示例8: on_deleteLandPushButton_clicked

void CTile_edit_dlg::on_deleteLandPushButton_clicked()
{
	int nindex = ui.landListWidget->currentRow();
	if (nindex != -1) 
	{
		tileBank.removeLand (nindex);
		QListWidgetItem* item = ui.landListWidget->takeItem(nindex);
		delete item;
	}
	else
	{
		QMessageBox::information( this, tr("No Land Selected"), tr("Please, select the Land to delete first ...") );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:14,代码来源:tile_edit_dlg.cpp

示例9: OnOk

void Browse::OnOk() 
{
	// TODO: Add your control notification handler code here
	if (thread_actif) return;

	// trap - Don't know if this is the right place to do this
	UpdateData ();
	CTileSet *tileSet=tileBank2.getTileSet (land);
	tileSet->setOriented(Oriented?true:false);


	this->SendMessage(WM_CLOSE);
	EndDialog(1);
}
开发者ID:mixxit,项目名称:solinia,代码行数:14,代码来源:Browse.cpp

示例10: on_orientedCheckBox_stateChanged

void CTile_edit_dlg::on_orientedCheckBox_stateChanged ( int state )
{
	if (!tileSetSelectionChanging)
	{
		int nindex = ui.tileSetListWidget->currentRow();
		if (nindex != -1) 
		{
			tileBank.getTileSet (nindex)->setOriented(ui.orientedCheckBox->isChecked());
		}
		else
		{
			QMessageBox::information( this, tr("No Tile Set Selected"), tr("Please, select a Tile Set first ...") );
		}
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:15,代码来源:tile_edit_dlg.cpp

示例11: on_savePushButton_clicked

void CTile_edit_dlg::on_savePushButton_clicked()
{
	string fullPath = this->mainFile.absoluteFilePath().toUtf8();
	if ( !fullPath.empty() )
	{
		COFile stream;
		if ( stream.open( fullPath.c_str() ) )
		{
			tileBank.serial (stream);
			QString s = tr("Bank %1 saved").arg( QString( fullPath.c_str() ) );
			QMessageBox::information(this, tr("Bank Saved"), s);
			return;
		}
	}

	QMessageBox::information(this, tr("Error"), tr("Can't Save Bank, check the path"));
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:17,代码来源:tile_edit_dlg.cpp

示例12: on_editLandPushButton_clicked

void CTile_edit_dlg::on_editLandPushButton_clicked()
{
	int nindex = ui.landListWidget->currentRow();
	if (nindex != -1) 
	{
		QStringList availableTileSetList;
		QStringList landTileSetList;
		for (int i=0; i<tileBank.getTileSetCount(); i++)
		{
			if (tileBank.getLand(nindex)->isTileSet (tileBank.getTileSet(i)->getName()))
				landTileSetList.append( QString( tileBank.getTileSet(i)->getName().c_str() ) );
			else
				availableTileSetList.append( QString( tileBank.getTileSet(i)->getName().c_str() ) );
		}

		bool ok = false;
		QStringList items = CItems_edit_dlg::getItems(this, tr("Edit Land"), ui.landListWidget->item(nindex)->text(), availableTileSetList, landTileSetList, &ok);

		if (ok)
		{
			for (int i=0; i<tileBank.getTileSetCount(); i++)
			{
				// remove tile set
				tileBank.getLand(nindex)->removeTileSet (tileBank.getTileSet(i)->getName());
			}
			for (int i=0; i<items.count(); i++)
			{
				QString rString = items[i];
				tileBank.getLand(nindex)->addTileSet( rString.toUtf8().constData() );
			}
		}
	}
	else
	{
		QMessageBox::information( this, tr("No Land Selected"), tr("Please, select the Land to edit first ...") );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:37,代码来源:tile_edit_dlg.cpp

示例13: on_upPushButton_clicked

void CTile_edit_dlg::on_upPushButton_clicked()
{
	int nindex = ui.tileSetListWidget->currentRow();
	if (nindex != -1) 
	{
		if (nindex > 0 )
		{
			tileBank.xchgTileset (nindex, nindex-1);
			QListWidgetItem* item = ui.tileSetListWidget->takeItem(nindex);
			ui.tileSetListWidget->insertItem(nindex - 1, item);

			ui.tileSetListWidget->setCurrentRow(nindex - 1);
		}
	}
	else
	{
		QMessageBox::information( this, tr("No Tile Set Selected"), tr("Please, select a Tile Set first ...") );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:19,代码来源:tile_edit_dlg.cpp

示例14: on_addLandPushButton_clicked

void CTile_edit_dlg::on_addLandPushButton_clicked()
{
    bool ok;
    QString text = QInputDialog::getText(this, tr("Add Land"), tr("Enter land name:"), QLineEdit::Normal, "", &ok);
    if (ok && !text.isEmpty())
	{
		if (ui.landListWidget->findItems(text, Qt::MatchExactly).count() > 0)
		{
			QMessageBox::information( this, tr("Error Adding Land"), tr("This name already exists") );
		}
		else
		{
			tileBank.addLand( text.toUtf8().constData() );

			ui.landListWidget->addItem(text);
			ui.landListWidget->setCurrentRow(ui.landListWidget->count() - 1);
		}
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:19,代码来源:tile_edit_dlg.cpp

示例15: on_surfaceDataLineEdit_textChanged

void CTile_edit_dlg::on_surfaceDataLineEdit_textChanged()
{
	if (!tileSetSelectionChanging)
	{
		int nindex = ui.tileSetListWidget->currentRow();
		if (nindex != -1) 
		{
			bool ok;
			uint intValue = ui.surfaceDataLineEdit->text().toUInt( &ok, 10 );
			if (ok)
			{
				tileBank.getTileSet (nindex)->SurfaceData = (uint32)intValue;
			}
		}
		else
		{
			QMessageBox::information( this, tr("No Tile Set Selected"), tr("Please, select a Tile Set first ...") );
		}
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:20,代码来源:tile_edit_dlg.cpp


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