本文整理汇总了C++中MapLayer::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ MapLayer::Get方法的具体用法?C++ MapLayer::Get怎么用?C++ MapLayer::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapLayer
的用法示例。
在下文中一共展示了MapLayer::Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
}
示例2: 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);
}
}
}
}
示例3: 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);
}
}
}
}
}
示例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);
//----------------------
}
}
}
}
}