Merge pull request #262 from natural-law/issue3831

Add interface for set the tiles opacity of TiledLayer.
This commit is contained in:
Wang Nan
2016-08-01 11:32:41 +08:00
committed by GitHub
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -204,6 +204,18 @@ void TMXLayer::setupTiles()
}
}
void TMXLayer::setTileOpacity(unsigned char opacity) {
_opacity = opacity;
for (int i = 0; i < _layerSize.width; i++) {
for (int j = 0; j < _layerSize.height; j++) {
Sprite* theTile = getTileAt(Vec2(i, j));
if (theTile) {
theTile->setOpacity(_opacity);
}
}
}
}
// TMXLayer - Properties
Value TMXLayer::getProperty(const std::string& propertyName) const
{
+7
View File
@@ -278,6 +278,13 @@ public:
inline void setProperties(const ValueMap& properties) {
_properties = properties;
};
/**
* Set the opacity of all tiles
* @param opacity The new opacity value
*/
void setTileOpacity(unsigned char opacity);
//
// Override
//