您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetTile函数代码示例

51自学网 2021-06-01 21:16:31
  C++
这篇教程C++ GetTile函数代码示例写得很实用,希望能帮到您。

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

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

示例1: GetTile

void CApp::OnMouseMove(int mX, int mY, int relX, int relY, bool Left,bool Right,bool Middle){    if (Left)    {        if(!(mX < TileWindow.Width && mY < TileWindow.Height))        {            if(InBounds(mX, mY))            {                GetTile( mX, mY);                Map->SetTile(tile, newTileID, newTypeID);            }        }    }    if (Right)    {        if(!(mX < TileWindow.Width && mY < TileWindow.Height))        {            if(InBounds(mX, mY))            {                if( ((mX - CCamera::CameraControl.GetX()) < MAP_WIDTH*TILE_SIZE*CArea::AreaControl.areaWidth) &&                        ((mY - CCamera::CameraControl.GetY()) < MAP_HEIGHT*TILE_SIZE*CArea::AreaControl.areaHeight) &&                        ((mYold - CCamera::CameraControl.GetY()) < MAP_HEIGHT*TILE_SIZE*CArea::AreaControl.areaHeight) &&                        ((mXold - CCamera::CameraControl.GetX()) < MAP_WIDTH*TILE_SIZE*CArea::AreaControl.areaWidth))                {                    // draws tiles but doesn't erase when you go too far                    GetTile( mX, mYold);                    Map->SetTile(tile, newTileID, newTypeID);                    GetTile(mXold, mY);                    Map->SetTile(tile, newTileID, newTypeID);                }            }        }    }}
开发者ID:leenephi,项目名称:GameLearning_LevelEditor,代码行数:34,


示例2: GetTile

    void PathNode::DebugDraw(Label* aLabel, Rect* aRect)    {#if DEBUG        //Draw the rect, the color represent which list the path node is in        aRect->SetLocalPosition(GetTile()->GetCenter(false));        aRect->SetSize(GetTile()->GetSize(), GetTile()->GetSize());        aRect->Draw();        //Draw the F score        stringstream ss;        ss << GetScoreF();        aLabel->SetText(ss.str());        aLabel->SetAnchorPoint(0.0f, 1.0f);        aLabel->SetLocalPosition(vec2(GetTile()->GetLocalX(), GetTile()->GetLocalY() + GetTile()->GetSize()));        aLabel->Draw();                //Draw the S score        ss.str("");        ss << GetScoreG();        aLabel->SetText(ss.str());        aLabel->SetAnchorPoint(0.0f, 0.0f);        aLabel->SetLocalPosition(vec2(GetTile()->GetLocalX(), GetTile()->GetLocalY()));        aLabel->Draw();                //Draw the H score        ss.str("");        ss << GetScoreH();        aLabel->SetText(ss.str());        aLabel->SetAnchorPoint(1.0f, 0.0f);        aLabel->SetLocalPosition(vec2(GetTile()->GetLocalX() + GetTile()->GetSize(), GetTile()->GetLocalY()));        aLabel->Draw();#endif    }
开发者ID:Epidilius,项目名称:ZeldaStyleAdventureGame,代码行数:33,


示例3: distance

int CCollision::IntersectAir(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision){	float d = distance(Pos0, Pos1);	vec2 Last = Pos0;	for(float f = 0; f < d; f++)	{		float a = f/d;		vec2 Pos = mix(Pos0, Pos1, a);		if(IsSolid(round_to_int(Pos.x), round_to_int(Pos.y)) || (!GetTile(round_to_int(Pos.x), round_to_int(Pos.y)) && !GetFTile(round_to_int(Pos.x), round_to_int(Pos.y))))		{			if(pOutCollision)				*pOutCollision = Pos;			if(pOutBeforeCollision)				*pOutBeforeCollision = Last;			if(!GetTile(round_to_int(Pos.x), round_to_int(Pos.y)) && !GetFTile(round_to_int(Pos.x), round_to_int(Pos.y)))				return -1;			else				if (!GetTile(round_to_int(Pos.x), round_to_int(Pos.y))) return GetTile(round_to_int(Pos.x), round_to_int(Pos.y));				else return GetFTile(round_to_int(Pos.x), round_to_int(Pos.y));		}		Last = Pos;	}	if(pOutCollision)		*pOutCollision = Pos1;	if(pOutBeforeCollision)		*pOutBeforeCollision = Pos1;	return 0;}
开发者ID:Ryozuki,项目名称:ddnet,代码行数:29,


示例4: GetTile

/*	Generate a tile type for the specific tile based on surrounding tiles height. */TerrainTest::tiletype TerrainTest::GetTileType(int x, int y){	tile* t = GetTile(x, y);	if (!t) return TILE_INVALID;	//Get height values of surrounding tiles	int n = -1, s = -1, e = -1, w = -1, se = -1, sw = -1, ne = -1, nw = -1;	int c = t->height;		tile* t2;	t2 = GetTile(x, y-1); if (t2) n = t2->height;	t2 = GetTile(x, y+1); if (t2) s = t2->height;	t2 = GetTile(x-1, y); if (t2) w = t2->height;	t2 = GetTile(x+1, y); if (t2) e = t2->height;	t2 = GetTile(x-1, y-1); if (t2) nw = t2->height;	t2 = GetTile(x+1, y-1); if (t2) ne = t2->height;	t2 = GetTile(x-1, y+1); if (t2) sw = t2->height;	t2 = GetTile(x+1, y+1); if (t2) se = t2->height;		//Use surrounding heights to determine our own type	if (e == c && w == c && n >= c && s < c && s != -1)		return TILE_SOUTHEDGE;		if (w >= c && e < c && e != -1 && n == c && s == c)		return TILE_EASTEDGE;			if (e >= c && w < c && w != -1 && n == c && s == c)		return TILE_WESTEDGE;		if (e == c && w == c && s >= c && n < c && n != -1)		return TILE_NORTHEDGE;	if (e < c && n < c && e != -1 && n != -1 && s >= c && w >= c)		return TILE_NEEDGE;		if (w < c && n < c && w != -1 && n != -1 && s >= c && e >= c)		return TILE_NWEDGE;		if (e < c && s < c && e != -1 && s != -1 && n >= c && w >= c)		return TILE_SEEDGE;		if (w < c && s < c && w != -1 && s != -1 && n >= c && e >= c)		return TILE_SWEDGE;		//Fix diagonals	if (n == c && e == c && ne < c && ne != -1)		return TILE_SWBEND;			if (n == c && w == c && nw < c && nw != -1)		return TILE_SEBEND;		if (s == c && e == c && se < c && se != -1)		return TILE_NWBEND;			if (s == c && w == c && sw < c && sw != -1)		return TILE_NEBEND;	return TILE_INVALID;}
开发者ID:McManning,项目名称:fro_client,代码行数:60,


示例5: checkMapCollision

int checkMapCollision(int x, int y, int testX, int testY){	testY -= 1;	if(GetTile(30,((x+testX)/8), ((y+testY)/8)) == 0){		return 1;	}	if(GetTile(30, ((x+testX)/8), ((y+testY)/8)) >= 21 	&& GetTile(30, ((x+testX)/8), ((y+testY)/8)) <= 25){		return 1;	}	if(GetTile(30, ((x+testX)/8), ((y+testY)/8)) >= 16 	&& GetTile(30, ((x+testX)/8), ((y+testY)/8)) <= 20){		return 2;	}	return 0;}
开发者ID:Peter-black,项目名称:SuperCrateBox-GBA,代码行数:15,


示例6: switch

void Map::ShipOccupy(int x, int y, Direction dir, Ship* ship){	int deltaX = 0;	int deltaY = 0;	switch (dir)	{	case DIR_UP:		deltaY = 1;		break;	case DIR_DOWN:		deltaY = -1;		break;	case DIR_LEFT:		deltaX = -1;		break;	case DIR_RIGHT:		deltaX = 1;		break;	}	for (int i = 0; i < ship->GetSize(); ++i)	{		Tile* tile = GetTile(x, y);		_ASSERT(tile != nullptr);		tile->SetOccupiedShip(ship);		x += deltaX;		y += deltaY;	}}
开发者ID:atgchan,项目名称:BattleShip,代码行数:29,


示例7: SynthesizeFrame

// Create a whole 'frame' from VP8 (+ alpha) or lossless.static int SynthesizeFrame(const WebPDemuxer* const dmux,                           const Frame* const first_frame,                           int tile_num, WebPIterator* const iter) {  const uint8_t* const mem_buf = dmux->mem_.buf_;  int num_tiles;  size_t payload_size = 0;  const Frame* const tile = GetTile(first_frame, tile_num, &num_tiles);  const uint8_t* const payload = GetFramePayload(mem_buf, tile, &payload_size);  if (payload == NULL) return 0;  iter->frame_num_   = first_frame->frame_num_;  iter->num_frames_  = dmux->num_frames_;  iter->tile_num_    = tile_num;  iter->num_tiles_   = num_tiles;  iter->x_offset_    = tile->x_offset_;  iter->y_offset_    = tile->y_offset_;  iter->width_       = tile->width_;  iter->height_      = tile->height_;  iter->duration_    = tile->duration_;  iter->complete_    = tile->complete_;  iter->tile_.bytes_ = payload;  iter->tile_.size_  = payload_size;  // TODO(jzern): adjust offsets for 'TILE's embedded in 'FRM 's  return 1;}
开发者ID:ansgri,项目名称:rsdt-students,代码行数:26,


示例8: Progress

void TERRAIN::CalculateAlphaMaps(){	Progress("Creating Alpha Map", 0.0f);	//Clear old alpha maps	if(m_pAlphaMap != NULL)		m_pAlphaMap->Release();	//Create new alpha map	D3DXCreateTexture(m_pDevice, 128, 128, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pAlphaMap);	//Lock the texture	D3DLOCKED_RECT sRect;	m_pAlphaMap->LockRect(0, &sRect, NULL, NULL);	BYTE *bytes = (BYTE*)sRect.pBits;	memset(bytes, 0, 128*sRect.Pitch);		//Clear texture to black	for(int i=0;i<(int)m_diffuseMaps.size();i++)		for(int y=0;y<sRect.Pitch / 4;y++)			for(int x=0;x<sRect.Pitch / 4;x++)			{				int terrain_x = (int)(m_size.x * (x / (float)(sRect.Pitch / 4.0f)));				int terrain_y = (int)(m_size.y * (y / (float)(sRect.Pitch / 4.0f)));				MAPTILE *tile = GetTile(terrain_x, terrain_y);				if(tile != NULL && tile->m_type == i)					bytes[y * sRect.Pitch + x * 4 + i] = 255;			}	//Unlock the texture	m_pAlphaMap->UnlockRect(0);		//D3DXSaveTextureToFile("alpha.bmp", D3DXIFF_BMP, m_pAlphaMap, NULL);}
开发者ID:Alriightyman,项目名称:RTS,代码行数:34,


示例9: PL_ASSERT

void TileGroup::SetValue(type::Value &value, oid_t tuple_id,                         oid_t column_id) {  PL_ASSERT(tuple_id < GetNextTupleSlot());  oid_t tile_column_id, tile_offset;  LocateTileAndColumn(column_id, tile_offset, tile_column_id);  GetTile(tile_offset)->SetValue(value, tuple_id, tile_column_id);}
开发者ID:foche,项目名称:peloton,代码行数:7,


示例10: GetTile

peloton::VarlenPool *TileGroup::GetTilePool(const oid_t tile_id) const {  Tile *tile = GetTile(tile_id);  if (tile != nullptr) return tile->GetPool();  return nullptr;}
开发者ID:jackylk,项目名称:iso_peloton,代码行数:7,


示例11: while

bool Layer::DrawTileToVertexArrays(VertexVector* vertices, unsigned int x, unsigned int y) const {	int tileX = x, tileY = y;	if (IsWidthTiled) { //this stuff can probably be optimized a bit by checking at some higher level?		if (tileX >= RealWidth)			tileX %= RealWidth;		else while (tileX < 0)			tileX += RealWidth;	}	else if (tileX < 0 || tileX >= RealWidth)		return false;	if (IsHeightTiled) {		if (tileY >= Height)			tileY %= Height;		else while (tileY < 0)			tileY += Height;	}	else if (tileY < 0 || tileY >= Height)		return false;	const Tile tile = GetTile(tileX, tileY);	if (tile.ID == 0)		return false;	quad tileQuad(LevelPtr->QuadsPerTile, tile);	tileQuad.positionPositionAt(x * TILEWIDTH, y * TILEHEIGHT);	tileQuad.appendTo(vertices[tileQuad.TextureID]);	return tile.ID >= LevelPtr->AnimOffset;}
开发者ID:Violet-CLM,项目名称:Bunny-Game,代码行数:26,


示例12: LOG_TRACE

/** * Grab next slot (thread-safe) and fill in the tuple * * Returns slot where inserted (INVALID_ID if not inserted) */void TileGroup::CopyTuple(const Tuple *tuple, const oid_t &tuple_slot_id) {    LOG_TRACE("Tile Group Id :: %u status :: %u out of %u slots ", tile_group_id,              tuple_slot_id, num_tuple_slots);    oid_t tile_column_count;    oid_t column_itr = 0;    for (oid_t tile_itr = 0; tile_itr < tile_count; tile_itr++) {        const catalog::Schema &schema = tile_schemas[tile_itr];        tile_column_count = schema.GetColumnCount();        storage::Tile *tile = GetTile(tile_itr);        PL_ASSERT(tile);        char *tile_tuple_location = tile->GetTupleLocation(tuple_slot_id);        PL_ASSERT(tile_tuple_location);        // NOTE:: Only a tuple wrapper        storage::Tuple tile_tuple(&schema, tile_tuple_location);        for (oid_t tile_column_itr = 0; tile_column_itr < tile_column_count;                tile_column_itr++) {            tile_tuple.SetValue(tile_column_itr, tuple->GetValue(column_itr),                                tile->GetPool());            column_itr++;        }    }}
开发者ID:tarunbansal,项目名称:peloton,代码行数:32,


示例13: GetTile

 /// /brief ///  Accesses tile by height sample indices inside this sector. Indices must be in valid range inline VSectorTile *GetTileAtSampleIndices(int x,int y) const {   x/=m_Config.m_iHeightSamplesPerTile[0];   y/=m_Config.m_iHeightSamplesPerTile[1];   // the height samples must be in range, but clamp at max edge because of extra overlapping values   return GetTile(hkvMath::Min(x,m_Config.m_iTilesPerSector[0]-1),hkvMath::Min(y,m_Config.m_iTilesPerSector[1]-1)); }
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:9,


示例14: GetTile

	cTile* cTileMapLineIt::Next()	{		GetTile();      	mbUpdated = false;		return mpTile;	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:7,


示例15: coord

void Map::Draw(Gdiplus::Graphics* g){	Vector3i northWestTile = mMapViewport->GetNorthWestTileCoordinate();	Vector3i southEastTile = mMapViewport->GetSouthEastTileCoordinate();	Vector2i origin = mMapViewport->GetTileOrigin(northWestTile);	int xTileCount = southEastTile.GetX() - northWestTile.GetX() + 1;	int yTileCount = southEastTile.GetY() - northWestTile.GetY() + 1;	int tileCount = xTileCount*yTileCount;	for(int i = 0; i<xTileCount; i++)	{		for(int j = 0; j<yTileCount; j++)		{			Vector3i coord(northWestTile.GetX() + i, northWestTile.GetY() + j, mMapViewport->GetZoom());			Tile* tile = GetTile(coord);			if(!tile->IsLoaded())			{				tile->SignalReady += [this](Tile* tile) {					std::lock_guard<std::mutex> lock(signal_mutex);					SignalNewTile.emit();				};				continue;			}			Gdiplus::Image* im = tile->GetImage();			if(im)				g->DrawImage(im, origin.GetX() + i*mMapSource->GetTileSize(), origin.GetY() + j*mMapSource->GetTileSize());		}	}}
开发者ID:Eisenheim9,项目名称:MultiTracks,代码行数:29,


示例16: SetupForegroundLayer

void SetupForegroundLayer(){    s16 tilepositionx = PIXEL_TO_TILE(-scrollData.scrollx_vdp) - 1; // divide by 8    s16 tilepositiony = PIXEL_TO_TILE(scrollData.scrolly_vdp) - 1; //     // compute start and end tiles    s16 starttilex = tilepositionx;    s16 endtilex = (tilepositionx + TILE_UPDATE_AREA_WIDTH);    s16 starttiley = tilepositiony;    s16 endtiley = (tilepositiony + TILE_UPDATE_AREA_HEIGHT);    s16 loop = 0;    s16 innerLoop = 0;    u16 tileNumber = 0;    u16 arrayStart = 0;	const u16 tileBaseValue = TILE_ATTR_FULL(PAL3, 0, 0, 0, 0) + foregroundLoadedTileInfo.startIndex;    for (loop = starttiley; loop <= endtiley; loop++)    {        arrayStart = loop * levelData.foreground->width;        for (innerLoop = starttilex; innerLoop <= endtilex; innerLoop++)        {            tileNumber = ARRAY_ITEM_VALUE(levelData.foreground->tilemap, arrayStart + innerLoop);			tileNumber = GetTile(tileNumber, tileBaseValue);            VDP_setTileMapXY(APLAN, tileNumber, innerLoop & 63, loop & 63);        }    }}
开发者ID:yoyz,项目名称:genesis,代码行数:29,


示例17: FindTileWithTag

std::pair<int,int> Level::GetSpawnPoint ( const std::string& entrance_tag ){	int startx, starty;	int entrance_exists = FindTileWithTag (entrance_tag, startx, starty);	if ( entrance_exists )	{		return std::make_pair ( startx, starty );	}	// If we get this far, it's probably the town (but it could be a malcreated dungeon with no entrance).	// Find a clear spot, anywhere will do.	for ( int x = 1; x < sizex; x++ )	{		for ( int y = 1; y < sizey; y++ )		{			LevelTile& tile = GetTile ( x, y );			if ( tile.tile->HasOneFlag ( FLAG_BLOCKS_MOVEMENT ) )				continue;			Mobile* mob = GetFirstMobileAt ( x, y );			if ( mob )				continue;			return std::make_pair ( x, y );		}	}	std::cerr << "Unable to find a player spawn point/n";	exit ( 1 );}
开发者ID:Gamer2k4,项目名称:basinrogue,代码行数:26,


示例18: GetTile

bool CCollision::IsTileSolid(int x, int y) const{	int Col = GetTile(x, y);	if(Col&COLFLAG_SOLID)		return true;	if(!(Col&COLFLAG_TL3)) 	{		if(Col&COLFLAG_RED && Col&COLFLAG_BLUE)		{			if(Col&COLFLAG_APPEAR)				return (Techlevel[0] >= 2 || Techlevel[1] >= 2);			else				return (Techlevel[0] < 2 && Techlevel[1] < 2);		}	} 	else 	{		if(Col&COLFLAG_RED && Col&COLFLAG_BLUE)		{			if(Col&COLFLAG_APPEAR)				return (Techlevel[0] == 3 || Techlevel[1] == 3);			else				return (Techlevel[0] < 3 && Techlevel[1] < 3);		}	}			if(Col & COLFLAG_APPEAR)		return (Col&COLFLAG_RED && !(Col&COLFLAG_TL3) && Techlevel[0] >= 2) || (Col&COLFLAG_RED && Col&COLFLAG_TL3 && Techlevel[0] == 3) || (Col&COLFLAG_BLUE && !(Col&COLFLAG_TL3) && Techlevel[1] >= 2) || (Col&COLFLAG_BLUE && Col&COLFLAG_TL3 && Techlevel[1] == 3);	else			return (Col&COLFLAG_RED && !(Col&COLFLAG_TL3) && Techlevel[0] < 2) || (Col&COLFLAG_RED && Col&COLFLAG_TL3 && Techlevel[0] < 3) || (Col&COLFLAG_BLUE && !(Col&COLFLAG_TL3) && Techlevel[1] < 2) || (Col&COLFLAG_BLUE && Col&COLFLAG_TL3 && Techlevel[1] < 3);}
开发者ID:FruchtiHD,项目名称:nodesRemake,代码行数:33,


示例19: GetTile

void TiledGroundMap::SetTile(int x, int y, const std::string& texture, int rotate, bool mirror){	Tile* tile = GetTile(x, y);	tile->texture = texture;	tile->rotate = rotate;	tile->mirror = mirror;}
开发者ID:openwar,项目名称:openwar,代码行数:7,


示例20: GetAbstractTable

/** * Apply the column delta on the rollback segment to the given tuple */void TileGroup::ApplyRollbackSegment(char *rb_seg, const oid_t &tuple_slot_id) {    auto seg_col_count = storage::RollbackSegmentPool::GetColCount(rb_seg);    auto table_schema = GetAbstractTable()->GetSchema();    for (size_t idx = 0; idx < seg_col_count; ++idx) {        auto col_id =            storage::RollbackSegmentPool::GetIdOffsetPair(rb_seg, idx)->col_id;        Value col_value =            storage::RollbackSegmentPool::GetValue(rb_seg, table_schema, idx);        // Get target tile        auto tile_id = GetTileIdFromColumnId(col_id);        PL_ASSERT(tile_id < GetTileCount());        storage::Tile *tile = GetTile(tile_id);        PL_ASSERT(tile);        // Get tile schema        auto &tile_schema = tile_schemas[tile_id];        // Get a tuple wrapper        char *tile_tuple_location = tile->GetTupleLocation(tuple_slot_id);        PL_ASSERT(tile_tuple_location);        storage::Tuple tile_tuple(&tile_schema, tile_tuple_location);        // Write the value to tuple        auto tile_col_idx = GetTileColumnId(col_id);        tile_tuple.SetValue(tile_col_idx, col_value, tile->GetPool());    }}
开发者ID:tarunbansal,项目名称:peloton,代码行数:32,


示例21: GetTile

void cShoot::CanShoot(int *map, cBicho &Player) {	int x,y;	GetTile(&x,&y);	if(map[x+(y*SCENE_WIDTH)] != 0) active = false;	else active = true;	if(active) {		if(GetState() == STATE_SHOOT_LEFT || GetState() == STATE_LOOKLEFT || GetState() == STATE_WALKLEFT ) {			active = !(Player.CollidesMapWall(map,false));			if(map[(x+1)+y*SCENE_WIDTH] != 0) active = false;			if(map[(x+2)+y*SCENE_WIDTH] != 0) active = false;		}		else if(GetState() == STATE_LOOKDOWN||GetState() == STATE_WALKDOWN) {			active = !(Player.CollidesTopBot(map,false));			if(map[x+((y+1)*SCENE_WIDTH)] != 0) active = false;		}		else if(GetState() == STATE_LOOKUP||GetState() == STATE_LOOKUP) {			active = !(Player.CollidesTopBot(map,true));		}		else if(GetState() == STATE_SHOOT_RIGHT || GetState() == STATE_LOOKRIGHT || GetState() == STATE_WALKRIGHT ) {			active = !(Player.CollidesMapWall(map,true));			if(map[(x+1)+y*SCENE_WIDTH] != 0) active = false;		}		else if(GetState() == STATE_DUPLEFT) {			active = !(Player.CollidesWall(map,false));		}	}}
开发者ID:oriac,项目名称:joc-3d,代码行数:28,


示例22: GetTile

TerrainTile* TerrainHolder::GetTile(float x, float y){	int32 tx = (int32)(32 - (x / TERRAIN_TILE_SIZE));	int32 ty = (int32)(32 - (y / TERRAIN_TILE_SIZE));	return GetTile(tx, ty);}
开发者ID:DebugProject,项目名称:Lua-Other,代码行数:7,


示例23: GetTile

void UTerrainManager::DiscoverCave(int32 x, int32 y) {	if (IsOutOfBounds(x, y))		return;	ATile* t = GetTile(x, y);	if (!t->IsVisible)	{		t->IsVisible = true;		DiscoverCave(x - 1, y);		DiscoverCave(x + 1, y);		DiscoverCave(x, y - 1);		DiscoverCave(x, y + 1);		DiscoverCave(x - 1, y + 1);		DiscoverCave(x + 1, y + 1);		DiscoverCave(x + 1, y - 1);		DiscoverCave(x - 1, y - 1);	}	if (t->IsWall()) {		if (UpdateWallAtTile(t))			CollapseTile(t);	}	else {		t->GetStaticMeshComponent()->SetStaticMesh(t->GroundMesh);		t->GetStaticMeshComponent()->SetMaterial(0, this->BiomeMaterials[t->TextureIndex()]);	}}
开发者ID:AmateurCz,项目名称:UnrealRaiders,代码行数:26,


示例24: GetMineTeeBlockAt

bool CCollision::IsTileSolid(int x, int y, bool nocoll){    //H-Client    if (nocoll && m_pMineTeeTiles)    {        if (((GetMineTeeBlockAt(x,y) >= BLOCK_UNDEF48 && GetMineTeeBlockAt(x,y) <= BLOCK_BED) ||         GetMineTeeBlockAt(x,y) == BLOCK_RSETA || GetMineTeeBlockAt(x,y) == BLOCK_BSETA) ||         GetMineTeeBlockAt(x,y) == BLOCK_TARTA1 || GetMineTeeBlockAt(x,y) == BLOCK_TARTA2)        {            int Nx = clamp(x/32, 0, m_Width-1);            int Ny = clamp(y/32, 0, m_Height-1);            Nx *= 32; Ny *= 32;            if (y >= Ny+16.0f)                return 1;            return 0;        }        else if (m_pMineTeeTiles && (GetMineTeeBlockAt(x,y) == BLOCK_AZUCAR ||                                     GetMineTeeBlockAt(x,y) == BLOCK_ROSAR || GetMineTeeBlockAt(x,y) == BLOCK_ROSAY ||                                     (GetMineTeeBlockAt(x,y) >= BLOCK_SEED1 && GetMineTeeBlockAt(x,y) <= BLOCK_SEED8) ||                                     GetMineTeeBlockAt(x,y) == BLOCK_SETAR1 || GetMineTeeBlockAt(x,y) == BLOCK_SETAR2))            return 0;    }	return GetTile(x, y)&COLFLAG_SOLID;}
开发者ID:def-,项目名称:HClient,代码行数:27,


示例25: Use

void SeedBag::Use() {   auto currentLandmark = GameState::Get().GetCurrentLandmark();   auto positionX = Player::Get().GetPositionX();   auto positionY = Player::Get().GetPositionY();   auto tile = currentLandmark->GetTile(positionX, positionY);   if (tile.TileType != TileType::Tilled) {      GameState::Get().AddLogMessage("The ground here is not tilled!");      return;   }   auto prop = currentLandmark->GetProp(positionX, positionY);   if (prop != nullptr) {      GameState::Get().AddLogMessage("There is already something here.");      return;   }   if (this->NumberOfSeeds <= 0) {      GameState::Get().AddLogMessage("There are no more seeds in this bag.");      return;   }   this->NumberOfSeeds--;   auto crop = PlantedCrop::Construct(Crop::FromCropType(this->CropType), CropGrowthType::Seedling);   currentLandmark->AddProp(positionX, positionY, crop);   auto cropName = Crop::FromCropType(this->CropType).Name;   bool startsWithVowel = cropName.find_first_of("aAeEiIoOuU") == 0;   GameState::Get().AddLogMessageFmt("You plant %s %s.", startsWithVowel ? "an" : "a", cropName.c_str());}
开发者ID:BoiPichu,项目名称:harvest-rogue,代码行数:28,


示例26: Plant

void Plantable::Plant(ItemPtr sourceItem){    auto x = Player::Get().GetPositionX();    auto y = Player::Get().GetPositionY();    auto currentLandmark = GameState::Get().GetCurrentLandmark();    auto currentTile = currentLandmark->GetTile(x, y);    if (currentTile.TileType != TileType::Tilled) {        GameState::Get().AddLogMessage("You can only plant on tilled land!");        return;    }    auto item = currentLandmark->GetItem(x, y);    if (item != nullptr) {        GameState::Get().AddLogMessageFmt("Cannot plant, %s is on the ground here.", item->GetName().c_str());        return;    }    auto crop = GameState::Get().GetItemFromItemDatabase(this->Crop);    crop->SetCount(1);    currentLandmark->AddItem(x, y, crop);    auto growableInterface = crop->GetInterface<Growable>(ItemInterfaceType::Growable);    if (growableInterface != nullptr) {        growableInterface->StartGrowing(crop);    }    sourceItem->RemoveOne();}
开发者ID:HarvestRogue,项目名称:harvest-rogue,代码行数:30,


示例27: Display

	void Display()	{		SDL_Rect t_pos;		t_pos.w = TILE_SIZE;		t_pos.h = TILE_SIZE;		for(t_pos.x = 0; t_pos.x < w*TILE_SIZE; t_pos.x+=TILE_SIZE)		{			for(t_pos.y = 0; t_pos.y < h*TILE_SIZE; t_pos.y+=TILE_SIZE)			{				if(GetTile(t_pos.x/TILE_SIZE,t_pos.y/TILE_SIZE).wall)				{					SDL_BlitSurface(i_wall,NULL,screen,&t_pos);				}				else				{					SDL_BlitSurface(i_grass,NULL,screen,&t_pos);				}			}		}		//display players		for(int i = 0; i < players.size(); i++)		{			SDL_BlitSurface(i_player,NULL,screen,&players[i]->GetScreenPos());		}		SDL_Flip(screen);	}
开发者ID:eagle2com,项目名称:bombernet,代码行数:28,


示例28: GetTile

type::AbstractPool *TileGroup::GetTilePool(const oid_t tile_id) const {  Tile *tile = GetTile(tile_id);  if (tile != nullptr) {    return tile->GetPool();  }  return nullptr;}
开发者ID:foche,项目名称:peloton,代码行数:9,



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


C++ GetTimeFormat函数代码示例
C++ GetTicks函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。