本文整理汇总了C++中setTile函数的典型用法代码示例。如果您正苦于以下问题:C++ setTile函数的具体用法?C++ setTile怎么用?C++ setTile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:dcbishop,项目名称:tx,代码行数:42,代码来源:Area.cpp
示例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, '@');
}
}
开发者ID:dmauk,项目名称:ASCII-Game-Test,代码行数:14,代码来源:Level.cpp
示例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));
}
}
}
}
开发者ID:interfect,项目名称:amalgam,代码行数:15,代码来源:map.cpp
示例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);
}
}
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:35,代码来源:CCActionTiledGrid.cpp
示例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);
}
}
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:35,代码来源:CCActionTiledGrid.cpp
示例6: memset
void TurnOffTiles::turnOffTile(const Point& pos)
{
Quad3 coords;
memset(&coords, 0, sizeof(Quad3));
setTile(pos, coords);
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:7,代码来源:CCActionTiledGrid.cpp
示例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);
}
}
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:32,代码来源:CCActionTiledGrid.cpp
示例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));
}
}
}
}
开发者ID:BruceHuang,项目名称:DustRacing2D,代码行数:27,代码来源:map.cpp
示例9: memset
void CCTurnOffTiles::turnOffTile(const CCPoint& pos)
{
ccQuad3 coords;
memset(&coords, 0, sizeof(ccQuad3));
setTile(pos, coords);
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:7,代码来源:CCActionTiledGrid.cpp
示例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;
}
开发者ID:bschalich,项目名称:Taverna,代码行数:35,代码来源:TavernExpansion.cpp
示例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);
}
}
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:32,代码来源:CCActionTiledGrid.cpp
示例12: setTile
void TileInfoView::onActiveUnitChanged(Unit* unit)
{
if (unit)
{
setTile(unit->tile());
}
}
开发者ID:jlippitt,项目名称:spacewar,代码行数:7,代码来源:TileInfoView.cpp
示例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) );
}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:31,代码来源:TileMapTest2.cpp
示例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);
}
}
开发者ID:CptAsgard,项目名称:featherkit,代码行数:29,代码来源:tilemap.cpp
示例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);
}
}
}
开发者ID:denis-jasselette,项目名称:Strates,代码行数:8,代码来源:fow.cpp
示例16: moveTo
/* move player (and box) from one position to another on the board */
int moveTo(int fromX, int fromY, int toX, int toY) {
int box = 0;
setTile(fromX, fromY, getGridTile(fromX, fromY));
char next = getTile(toX, toY);
if (next == TARGET) setTile(toX, toY, PLAYER_ON_TARGET);
else if (next == BOX || next == BOX_ON_TARGET) {
box = 1;
next = getGridTile(toX, toY);
if (next == BLANK) setTile(toX, toY, PLAYER);
else if (next == TARGET) {
setTile(toX, toY, PLAYER_ON_TARGET);
increaseRemaining();
}
int newMovableY = toY+(toY-fromY);
int newMovableX = toX+(toX-fromX);
char newMovablePos = getTile(newMovableX, newMovableY);
if (newMovablePos == BLANK) setTile(newMovableX, newMovableY, BOX);
else if (newMovablePos == TARGET) {
setTile(newMovableX, newMovableY, BOX_ON_TARGET);
decreaseRemaining();
}
}
else if (next == BLANK) setTile(toX, toY, PLAYER);
return box;
}
开发者ID:Desarc,项目名称:Mikrokontr,代码行数:26,代码来源:sokoban_move.c
示例17: changeTile
// Called in level. This function does the same as setTile, but also draws directly to the scrollsurface
// used normally, when items are picked up
bool CMap::changeTile(Uint16 x, Uint16 y, Uint16 t)
{
if( setTile( x, y, t ) )
{
m_Tilemaps.at(1).drawTile(g_pVideoDriver->getScrollSurface(), (x<<4)&511, (y<<4)&511, t);
return true;
}
return false;
}
开发者ID:Shayster,项目名称:Commander-Genius,代码行数:11,代码来源:CMap.cpp
示例18: FOR_EACH
FOR_EACH (Path::const_iterator, i, road)
{
const Position &pos = (*i);
MapItem *const item = getTile(pos.x, pos.y);
if (!item)
setTile(pos.x, pos.y, new MapItem(MapItemType::ROAD));
else
item->setType(MapItemType::ROAD);
}
开发者ID:Action-Committee,项目名称:ManaPlus,代码行数:9,代码来源:speciallayer.cpp
示例19: setTile
/**
* Fills an area with tiles.
* @param x1 Start x coordinate.
* @param y1 Start y coordinate.
* @param x2 End x coordinate.
* @param y2 End y coordinate.
* @param filename Tile's model filename.
* @param solidness The tile's solid state.
* @param rotation Tile's rotation.
*/
void Area::fill(const int x1, const int y1, const int x2, const int y2, const string filename, const bool solidity, const float rotation) {
for(int y = y1; y <= y2; y++) {
for(int x = x1; x <= x2; x++) {
setTile(x, y, new Tile(filename));
setRotation(x, y, rotation);
setSolid(x, y, solidity);
}
}
}
开发者ID:dcbishop,项目名称:tx,代码行数:19,代码来源:Area.cpp
示例20: createFeature
bool createFeature(int x, int y, Direction dir)
{
static const int roomChance = 50; // corridorChance = 100 - roomChance
int dx = 0;
int dy = 0;
if (dir == North)
dy = 1;
else if (dir == South)
dy = -1;
else if (dir == West)
dx = 1;
else if (dir == East)
dx = -1;
if (getTile(x + dx, y + dy) != Floor && getTile(x + dx, y + dy) != Corridor)
return false;
if (randomInt(100) < roomChance)
{
if (makeRoom(x, y, dir))
{
setTile(x, y, ClosedDoor);
return true;
}
}
else
{
if (makeCorridor(x, y, dir))
{
if (getTile(x + dx, y + dy) == Floor)
setTile(x, y, ClosedDoor);
else // don't place a door between corridors
setTile(x, y, Corridor);
return true;
}
}
return false;
}
开发者ID:leo-lu,项目名称:common,代码行数:44,代码来源:random_map.cpp
注:本文中的setTile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论