本文整理汇总了C++中setTile函数的典型用法代码示例。如果您正苦于以下问题:C++ setTile函数的具体用法?C++ setTile怎么用?C++ setTile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fill
/**
* For debugging, makes a square room on the map.
* @param x1
* @param y1
* @param x2
* @param y2
*/
void Area::boxRoom(const int x1, const int y1, const int x2, const int y2) {
// Floor
fill(x1+1, y1+1, x2-1, y2-1, TILE_FLOOR);
// Top side
fill(x1+1, y1, x2-1, y1, TILE_WALL, true, -90.0f);
// Left side
fill(x1, y1+1, x1, y2-1, TILE_WALL, true);
// Right side
fill(x2, y1+1, x2, y2-1, TILE_WALL, true, 180.0f);
// Bottom side
fill(x1+1, y2, x2-1, y2, TILE_WALL, true, 90.0f);
// TL
setTile(x1, y1, new Tile(TILE_INNERCORNER));
setRotation(x1, y1, -90.0f);
setSolid(x1, y1);
// BL
setTile(x1, y2, new Tile(TILE_INNERCORNER));
setSolid(x1, y2);
// TR
setTile(x2, y1, new Tile(TILE_INNERCORNER));
setRotation(x2, y1, -180.0f);
setSolid(x2, y1);
// BR
setTile(x2, y2, new Tile(TILE_INNERCORNER));
setRotation(x2, y2, 90.0f);
setSolid(x2, y2);
}
示例2: getTile
void Level::processPlayerMove(Player &player, int x, int y)
{
int playerX;
int playerY;
player.getLocation(playerX, playerY);
char moveTile;
moveTile = getTile(x, y);
switch (moveTile) {
case '.':
player.setLocation(x,y);
setTile(playerX,playerY, '.');
setTile(x,y, '@');
}
}
示例3: setTile
void Map::make_rectangle(int x, int y, int width, int height) {
for(int i = x; i < x + width; i++) {
for(int j = y; j < y + height; j++) {
if(i == x || i == x + width - 1 || j == y || j == y + height - 1) {
// We're on the border. Set a border tile if there's not ile set already
if(!map.count(std::make_pair(i, j))) {
setTile(i, j, Tile('#', false));
}
} else {
// We need to carve out a passable place
setTile(i, j, Tile('.', true));
}
}
}
}
示例4: CC_UNUSED_PARAM
void CCShakyTiles3D::update(float time)
{
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.height; ++j)
{
ccQuad3 coords = originalTile(ccp(i, j));
// X
coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.br.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tr.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
// Y
coords.bl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.br.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tr.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
if (m_bShakeZ)
{
coords.bl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.br.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
}
setTile(ccp(i, j), coords);
}
}
}
示例5: CC_UNUSED_PARAM
void ShakyTiles3D::update(float time)
{
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < _gridSize.width; ++i)
{
for (j = 0; j < _gridSize.height; ++j)
{
Quad3 coords = getOriginalTile(Point(i, j));
// X
coords.bl.x += ( rand() % (_randrange*2) ) - _randrange;
coords.br.x += ( rand() % (_randrange*2) ) - _randrange;
coords.tl.x += ( rand() % (_randrange*2) ) - _randrange;
coords.tr.x += ( rand() % (_randrange*2) ) - _randrange;
// Y
coords.bl.y += ( rand() % (_randrange*2) ) - _randrange;
coords.br.y += ( rand() % (_randrange*2) ) - _randrange;
coords.tl.y += ( rand() % (_randrange*2) ) - _randrange;
coords.tr.y += ( rand() % (_randrange*2) ) - _randrange;
if (_shakeZ)
{
coords.bl.z += ( rand() % (_randrange*2) ) - _randrange;
coords.br.z += ( rand() % (_randrange*2) ) - _randrange;
coords.tl.z += ( rand() % (_randrange*2) ) - _randrange;
coords.tr.z += ( rand() % (_randrange*2) ) - _randrange;
}
setTile(Point(i, j), coords);
}
}
}
示例6: memset
void TurnOffTiles::turnOffTile(const Point& pos)
{
Quad3 coords;
memset(&coords, 0, sizeof(Quad3));
setTile(pos, coords);
}
示例7: getOriginalTile
void JumpTiles3D::update(float time)
{
int i, j;
float sinz = (sinf((float)M_PI * time * _jumps * 2) * _amplitude * _amplitudeRate );
float sinz2 = (sinf((float)M_PI * (time * _jumps * 2 + 1)) * _amplitude * _amplitudeRate );
for( i = 0; i < _gridSize.width; i++ )
{
for( j = 0; j < _gridSize.height; j++ )
{
Quad3 coords = getOriginalTile(Point(i, j));
if ( ((i+j) % 2) == 0 )
{
coords.bl.z += sinz;
coords.br.z += sinz;
coords.tl.z += sinz;
coords.tr.z += sinz;
}
else
{
coords.bl.z += sinz2;
coords.br.z += sinz2;
coords.tl.z += sinz2;
coords.tr.z += sinz2;
}
setTile(Point(i, j), coords);
}
}
}
示例8: TrackTile
void Map::createEmptyTiles()
{
// Create tiles and set coordinates.
for (unsigned int j = 0; j < rows(); j++)
{
for (unsigned int i = 0; i < cols(); i++)
{
if (!getTile(i, j))
{
TrackTileBase * newTile = new TrackTile(
static_cast<TrackData &>(trackData()),
QPointF(TrackTile::TILE_W / 2 + i * TrackTile::TILE_W,
TrackTile::TILE_H / 2 + j * TrackTile::TILE_H),
QPoint(i, j));
setTile(i, j, TrackTilePtr(newTile));
}
else
{
getTile(i, j)->setLocation(
QPointF(
TrackTile::TILE_W / 2 + i * TrackTile::TILE_W,
TrackTile::TILE_H / 2 + j * TrackTile::TILE_H));
getTile(i, j)->setMatrixLocation(QPoint(i, j));
}
}
}
}
示例9: memset
void CCTurnOffTiles::turnOffTile(const CCPoint& pos)
{
ccQuad3 coords;
memset(&coords, 0, sizeof(ccQuad3));
setTile(pos, coords);
}
示例10: getBorders
//t is for type
bool TavernExpansion::makeExpansion(String tileMat, int t)
{
int rowChange = row / 2;
int colChange = col / 2;
String tMat = "GridMaterial";
getBorders();
if (this->viableExpansion() == true)
{
TavernResources::getInstance()->removeGold(row * col * TavernResources::getInstance()->getTilePrice());
TavernResources::getInstance()->incrementTilePrice();
TavernResources::getInstance()->addBuildRep(row * col * 20);
TavernResources::getInstance()->calcRep();
for (int dRow = -rowChange; dRow <= rowChange; dRow++)
{
for (int dCol = -colChange; dCol <= colChange; dCol++)
{
if (centerPos.x + dRow > 0 && centerPos.x + dRow < DIM - 1 && centerPos.y + dCol > 0 && centerPos.y + dCol < DIM - 1)
{
setTile(dRow, dCol, tMat, TILE, true);
setTE(dRow, dCol, true);
}
}
}
configureTiles(tMat);
//redoBotWalls();
return true;
}
return false;
}
示例11: originalTile
void CCJumpTiles3D::update(float time)
{
int i, j;
float sinz = (sinf((float)M_PI * time * m_nJumps * 2) * m_fAmplitude * m_fAmplitudeRate );
float sinz2 = (sinf((float)M_PI * (time * m_nJumps * 2 + 1)) * m_fAmplitude * m_fAmplitudeRate );
for( i = 0; i < m_sGridSize.width; i++ )
{
for( j = 0; j < m_sGridSize.height; j++ )
{
ccQuad3 coords = originalTile(ccp(i, j));
if ( ((i+j) % 2) == 0 )
{
coords.bl.z += sinz;
coords.br.z += sinz;
coords.tl.z += sinz;
coords.tr.z += sinz;
}
else
{
coords.bl.z += sinz2;
coords.br.z += sinz2;
coords.tl.z += sinz2;
coords.tr.z += sinz2;
}
setTile(ccp(i, j), coords);
}
}
}
示例12: setTile
void TileInfoView::onActiveUnitChanged(Unit* unit)
{
if (unit)
{
setTile(unit->tile());
}
}
示例13: getChildByTag
void TileMapEditTestNew::updateMap(float dt)
{
// IMPORTANT
// The only limitation is that you cannot change an empty, or assign an empty tile to a tile
// The value 0 not rendered so don't assign or change a tile with value 0
auto tilemap = (TileMapAtlas*) getChildByTag(kTagTileMap);
//
// For example you can iterate over all the tiles
// using this code, but try to avoid the iteration
// over all your tiles in every frame. It's very expensive
// for(int x=0; x < tilemap.tgaInfo->width; x++) {
// for(int y=0; y < tilemap.tgaInfo->height; y++) {
// Color3B c =[tilemap tileAt:Size(x,y));
// if( c.r != 0 ) {
// ////----CCLOG("%d,%d = %d", x,y,c.r);
// }
// }
// }
// NEW since v0.7
Color3B c = tilemap->getTileAt(Vec2(13,21));
c.r++;
c.r %= 50;
if( c.r==0)
c.r=1;
// NEW since v0.7
tilemap->setTile(c, Vec2(13,21) );
}
示例14: setTile
void TileMap::tick()
{
std::vector<glm::uvec2> toSet;
std::vector<TileId> ids;
for(auto animated = mAnimatedTiles.begin(); animated != mAnimatedTiles.end();)
{
if(animated->second.mTimeLeft == 0)
{
uint32_t x = animated->first.x;
uint32_t y = animated->first.y;
TileId id = animated->second.mNext;
animated = mAnimatedTiles.erase(animated);
toSet.push_back(glm::uvec2(x, y));
ids.push_back(id);
continue;
}
else
{
animated->second.mTimeLeft--;
animated++;
}
}
for(uint32_t i = 0; i < toSet.size(); i++)
{
setTile(toSet[i], ids[i], PRESERVE);
}
}
示例15: setTile
void FoW::reset(FogStatus value) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
status[i][j] = value;
setTile(j, i, (value == HIDDEN)? ALL : NONE);
}
}
}