| 246 | } |
| 247 | |
| 248 | void TileMap::DrawTile(Camera *camera, ScreenRect dstRect, int index) { |
| 249 | if (!atlas || !atlas->sourceRectangles) |
| 250 | return; |
| 251 | if (index < 0 || index >= atlas->totalFrames) |
| 252 | return; |
| 253 | |
| 254 | srcRect = atlas->sourceRectangles[index]; |
| 255 | glTexCoord2d(srcRect.fLeft(), srcRect.fTop()); |
| 256 | glVertex2f(dstRect.fLeft(), dstRect.fBottom()); |
| 257 | glTexCoord2d(srcRect.fRight(), srcRect.fTop()); |
| 258 | glVertex2f(dstRect.fRight(), dstRect.fBottom()); |
| 259 | glTexCoord2d(srcRect.fRight(), srcRect.fBottom()); |
| 260 | glVertex2f(dstRect.fRight(), dstRect.fTop()); |
| 261 | glTexCoord2d(srcRect.fLeft(), srcRect.fBottom()); |
| 262 | glVertex2f(dstRect.fLeft(), dstRect.fTop()); |
| 263 | } |
| 264 | |
| 265 | bool isAnimatedTile(int index) { return (index > 239) && (index < 256); } |
| 266 | |