| 208 | } |
| 209 | |
| 210 | void TileMap::draw() { |
| 211 | GlobalBatchRenderer::instance()->draw(); |
| 212 | |
| 213 | if ( getClippedArea() ) { |
| 214 | GLi->getClippingMask()->clipPlaneEnable( mScreenPos.x, mScreenPos.y, mViewSize.x, |
| 215 | mViewSize.y ); |
| 216 | } |
| 217 | |
| 218 | if ( getDrawBackground() ) { |
| 219 | Primitives P; |
| 220 | |
| 221 | Uint8 Alpha = static_cast<Uint8>( (Float)mBackColor.a * ( (Float)mBackAlpha / 255.f ) ); |
| 222 | |
| 223 | P.setColor( Color( mBackColor.r, mBackColor.g, mBackColor.b, Alpha ) ); |
| 224 | P.drawRectangle( |
| 225 | Rectf( Vector2f( mScreenPos.x, mScreenPos.y ), Sizef( mViewSize.x, mViewSize.y ) ), 0.f, |
| 226 | Vector2f::One ); |
| 227 | P.setColor( Color( 255, 255, 255, 255 ) ); |
| 228 | } |
| 229 | |
| 230 | GLi->pushMatrix(); |
| 231 | GLi->translatef( ( Float ) static_cast<Int32>( mScreenPos.x + mOffset.x ), |
| 232 | ( Float ) static_cast<Int32>( mScreenPos.y + mOffset.y ), 0 ); |
| 233 | GLi->scalef( mScale, mScale, 0 ); |
| 234 | |
| 235 | gridDraw(); |
| 236 | |
| 237 | for ( Uint32 i = 0; i < mLayerCount; i++ ) { |
| 238 | if ( mLayers[i]->isVisible() ) |
| 239 | mLayers[i]->draw(); |
| 240 | } |
| 241 | |
| 242 | mouseOverDraw(); |
| 243 | |
| 244 | if ( mDrawCb ) |
| 245 | mDrawCb(); |
| 246 | |
| 247 | GlobalBatchRenderer::instance()->draw(); |
| 248 | |
| 249 | GLi->popMatrix(); |
| 250 | |
| 251 | if ( getClippedArea() ) { |
| 252 | GLi->getClippingMask()->clipPlaneDisable(); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | void TileMap::mouseOverDraw() { |
| 257 | if ( !getDrawTileOver() || NULL == mTileTex ) |
no test coverage detected