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


C++ TileSet::GetTileRect方法代码示例

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


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

示例1: GetTilesetFromTileId

void j1Map::Draw()
{
	if(map_loaded == false)
		return;

	p2List_item<MapLayer*>* item = data.layers.start;

	for(; item != NULL; item = item->next)
	{
		MapLayer* layer = item->data;

		if(layer->properties.Get("Nodraw") != 0)
			continue;

		for(int y = 0; y < data.height; ++y)
		{
			for(int x = 0; x < data.width; ++x)
			{
				int tile_id = layer->Get(x, y);
				if(tile_id > 0)
				{
					TileSet* tileset = GetTilesetFromTileId(tile_id);

					SDL_Rect r = tileset->GetTileRect(tile_id);
					iPoint pos = MapToWorld(x, y);

					App->render->Blit(tileset->texture, pos.x, pos.y, &r);
				}
			}
		}
	}
}
开发者ID:thedoctormarc,项目名称:Dev_Repos,代码行数:32,代码来源:j1Map.cpp

示例2: GetTilesetFromTileId

void j1Map::Draw()
{
	if(map_loaded == false)
		return;
	//STL CHANGE
	list<MapLayer*>::iterator item = data.layers.begin();

	for(; item != data.layers.end(); ++item)
	{
		MapLayer* layer = *item;

		if(layer->properties.Get("Nodraw") != 0)
			continue;

		for(int y = 0; y < data.height; ++y)
		{
			for(int x = 0; x < data.width; ++x)
			{
				int tile_id = layer->Get(x, y);
				if(tile_id > 0)
				{
					TileSet* tileset = GetTilesetFromTileId(tile_id);

					SDL_Rect r = tileset->GetTileRect(tile_id);
					iPoint pos = MapToWorld(x, y);

					App->render->Blit(tileset->texture, pos.x, pos.y, &r);
				}
			}
		}
	}
}
开发者ID:JaviSaba7,项目名称:Pixel_Mirror--Diablo_II,代码行数:32,代码来源:j1Map.cpp

示例3: MapToWorld

void j1Map::Draw()
{
	if(map_loaded == false)
		return;

	// TODO 5: Prepare the loop to draw all tilesets + Blit
	MapLayer* layer = data.layers.start->data;

	for(int y = 0; y < data.height; ++y)
	{
		for(int x = 0; x < data.width; ++x)
		{
			int tile_id = layer->Get(x, y);
			if(tile_id > 0)
			{
				// TODO 10(old): Complete the draw function
				TileSet* tileset = data.tilesets.start->data;

				SDL_Rect r = tileset->GetTileRect(tile_id);
				iPoint pos = MapToWorld(x, y);

				App->render->Blit(tileset->texture, pos.x, pos.y, &r);
			}
		}
	}
}
开发者ID:AlexisCosano,项目名称:Development,代码行数:26,代码来源:j1Map.cpp

示例4: if

void j1Map::Draw()
{
	if(map_loaded == false)
		return;
	//STL CHANGE
	//NOTE: well
	//Camera Culling
	//----------------------
	SDL_Rect cam = App->render->camera;
	//----------------------

	list<MapLayer*>::iterator item = data.layers.begin();

	for(; item != data.layers.end(); ++item)
	{
		MapLayer* layer = *item;


		//NOTE: when drawing navigation map, framerate drops to the half
		if (!App->debug)
			if(layer->properties.Get("Nodraw") != 0)
				continue;

		for(int y = 0; y < data.height; ++y)
		{
			for(int x = 0; x < data.width; ++x)
			{
				int tile_id = layer->Get(x, y);
				if(tile_id > 0)
				{
					TileSet* tileset = GetTilesetFromTileId(tile_id);

					SDL_Rect r = tileset->GetTileRect(tile_id);
					iPoint pos = MapToWorld(x, y);

					//NOTE: Maybe this has to be implemented on Render.cpp
					//NOTE: changing the offset of the tiles because Ric cheated with the original, think about make it general for any map
					//NOTE: because of test sake
					//----------------------

						if (layer->name == "Background")
							App->render->Blit(tileset->texture, pos.x - data.tile_width / 2 + tileset->offset_x, pos.y, &r);
						else if (layer->name == "Navigation")
							App->render->Blit(tileset->texture, pos.x - data.tile_width / 2 , pos.y, &r);
						
					
					//----------------------
				}
			}
		}
	}
	
}
开发者ID:joeyGumer,项目名称:Pixel_Mirror--Diablo_II,代码行数:53,代码来源:j1Map.cpp

示例5: GetTilesetFromTileId

void j1Map::Draw()
{
	if(map_loaded == false)
		return;

	// TODO 4: Make sure we draw all the layers and not just the first one
	p2List_item<MapLayer*>* layer = data.layers.start;

	while (layer)
	{	
		//This makes appear the Navigation Layer
		if (layer->data->name == "Meta" && App->input->GetKey(SDL_SCANCODE_I) == KEY_DOWN)
		{
			if (layer->data->properties.GetPropertyValue("Draw") == 0)
				layer->data->properties.SetPropertyValue("Draw", 1);
			else
				layer->data->properties.SetPropertyValue("Draw", 0);
		}
		//------------------------------------
		if (layer->data->properties.GetPropertyValue("Draw"))
		{
			for (int y = 0; y < data.height; ++y)
			{
				for (int x = 0; x < data.width; ++x)
				{
					int tile_id = layer->data->Get(x, y);
					if (tile_id > 0)
					{
						TileSet* tileset = GetTilesetFromTileId(tile_id);

						if (tileset != NULL)
						{
							SDL_Rect r = tileset->GetTileRect(tile_id);
							iPoint pos = MapToWorld(x, y);

							App->render->Blit(tileset->texture, pos.x + tileset->offset_x, pos.y + tileset->offset_y, &r);
						}
					}
				}
			}
		}
		layer = layer->next;
	}
}
开发者ID:joeyGumer,项目名称:Videogames_Development,代码行数:44,代码来源:j1Map.cpp


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