本文整理汇总了C++中GetTile函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTile函数的具体用法?C++ GetTile怎么用?C++ GetTile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:CApp_OnEvent.cpp
示例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,代码来源:PathNode.cpp
示例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,代码来源:collision.cpp
示例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,代码来源:TerrainTest.cpp
示例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,代码来源:main.cpp
示例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,代码来源:Map.cpp
示例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,代码来源:demux.c
示例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,代码来源:terrain.cpp
示例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,代码来源:tile_group.cpp
示例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,代码来源:tile_group.cpp
示例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,代码来源:Layer.cpp
示例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,代码来源:tile_group.cpp
示例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,代码来源:TerrainSector.hpp
示例14: GetTile
cTile* cTileMapLineIt::Next()
{
GetTile();
mbUpdated = false;
return mpTile;
}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:7,代码来源:TileMapLineIt.cpp
示例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,代码来源:Map.cpp
示例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,代码来源:LevelManager.c
示例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,代码来源:level.cpp
示例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,代码来源:collision.cpp
示例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,代码来源:TiledGroundMap.cpp
示例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,代码来源:tile_group.cpp
注:本文中的GetTile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论