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


C++ Tile::GetWidth方法代码示例

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


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

示例1: DrawTile

void cEdiPaint::DrawTile( int idx, int x, int y, dword color, int flip, int frame, Blend blend, float scale )
{
	Tile* tile = TileGet(idx); 
	if(tile==NULL) return;

	int w = tile->GetWidth();
	int h = tile->GetHeight();
	if(frame<0) frame=0;
	frame = frame % tile->frames;
	int fx = tile->GetFx(frame);
	int fy = tile->GetFy(frame);
	fRect src(fx * w, fy * h, (fx+1) * w, (fy + 1) * h);
	R9_SetBlend(blend);
	R9_DrawSprite( fV2(x, y), src, tile->tex, color, flip, scale );

}
开发者ID:leprosarium,项目名称:prolozzy,代码行数:16,代码来源:EdiPaint.cpp

示例2: SaveMap

	/*
		returns true or false if it saved----->do something with result to show user
		Saves the map in XML format
		hmmm using standard type members as attributes
		using complex objects members as nodes
		<map attrib1="" attrib2="" attrib3="">
			<tileset>
				<tile attribute1="blah" />
				<tile attribute1="blah" />
				<tile attribute1="blah" />
				<tile attribute1="blah" />
			</tileset>

		</map>
	*/
	bool Map::SaveMap()
	{
		pugi::xml_document xmlDoc;	
		pugi::xml_node xmlMap = xmlDoc.append_child("map");
		xmlMap.append_attribute("width").set_value(width_);
		xmlMap.append_attribute("height").set_value(height_);
		//objectify player soon
		xmlMap.append_attribute("playerplaced").set_value(playerplaced_);
		xmlMap.append_attribute("playerx").set_value(playerStartX_);
		xmlMap.append_attribute("playery").set_value(playerStartY_);
		pugi::xml_node xmlTileSet = xmlMap.append_child("tilevector");
		for(int i = 0; i < tiles_.size(); i++)
		{
			for(int j = 0; j < tiles_[i].size(); j++)
			{
				Tile *currentTile = &tiles_[i][j];
				pugi::xml_node xmlCurrentTile = xmlTileSet.append_child("tile");
				xmlCurrentTile.append_attribute("tiletype").set_value(currentTile->GetTileType());
				xmlCurrentTile.append_attribute("x").set_value(currentTile->GetCurrentPositionX());
				xmlCurrentTile.append_attribute("y").set_value(currentTile->GetCurrentPositionY());
				xmlCurrentTile.append_attribute("clickable").set_value(currentTile->GetClickable());
				xmlCurrentTile.append_attribute("color_a").set_value(currentTile->GetColor().a);
				xmlCurrentTile.append_attribute("color_b").set_value(currentTile->GetColor().b);
				xmlCurrentTile.append_attribute("color_g").set_value(currentTile->GetColor().g);
				xmlCurrentTile.append_attribute("color_r").set_value(currentTile->GetColor().r);
				xmlCurrentTile.append_attribute("height").set_value(currentTile->GetHeight());
				xmlCurrentTile.append_attribute("width").set_value(currentTile->GetWidth());
				xmlCurrentTile.append_attribute("movespeed").set_value(currentTile->GetMoveSpeed());


				if(currentTile->GetHasImage())
				{
					pugi::xml_node xmlCurrentImage = xmlCurrentTile.append_child("image");
					xmlCurrentImage.append_attribute("id").set_value(currentTile->GetObjectImage()->GetId());
				}
			}
		}
		return xmlDoc.save_file(al_path_cstr(mapPath_,'/'));
	}
开发者ID:,项目名称:,代码行数:54,代码来源:


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