| 237 | } |
| 238 | |
| 239 | void TileView::renderStrategyOverlay(Renderer &r) |
| 240 | { |
| 241 | if (this->viewMode == TileViewMode::Strategy) |
| 242 | { |
| 243 | Vec2<float> centerIsoScreenPos = this->tileToScreenCoords( |
| 244 | Vec3<float>{this->centerPos.x, this->centerPos.y, 0}, TileViewMode::Isometric); |
| 245 | |
| 246 | /* Draw the rectangle of where the isometric view would be */ |
| 247 | Vec2<float> topLeftIsoScreenPos = centerIsoScreenPos; |
| 248 | topLeftIsoScreenPos.x -= dpySize.x / 2; |
| 249 | topLeftIsoScreenPos.y -= dpySize.y / 2; |
| 250 | |
| 251 | Vec2<float> topRightIsoScreenPos = centerIsoScreenPos; |
| 252 | topRightIsoScreenPos.x += dpySize.x / 2; |
| 253 | topRightIsoScreenPos.y -= dpySize.y / 2; |
| 254 | |
| 255 | Vec2<float> bottomLeftIsoScreenPos = centerIsoScreenPos; |
| 256 | bottomLeftIsoScreenPos.x -= dpySize.x / 2; |
| 257 | bottomLeftIsoScreenPos.y += dpySize.y / 2; |
| 258 | |
| 259 | Vec2<float> bottomRightIsoScreenPos = centerIsoScreenPos; |
| 260 | bottomRightIsoScreenPos.x += dpySize.x / 2; |
| 261 | bottomRightIsoScreenPos.y += dpySize.y / 2; |
| 262 | |
| 263 | Vec3<float> topLeftIsoTilePos = |
| 264 | this->screenToTileCoords(topLeftIsoScreenPos, 0.0f, TileViewMode::Isometric); |
| 265 | Vec3<float> topRightIsoTilePos = |
| 266 | this->screenToTileCoords(topRightIsoScreenPos, 0.0f, TileViewMode::Isometric); |
| 267 | Vec3<float> bottomLeftIsoTilePos = |
| 268 | this->screenToTileCoords(bottomLeftIsoScreenPos, 0.0f, TileViewMode::Isometric); |
| 269 | Vec3<float> bottomRightIsoTilePos = |
| 270 | this->screenToTileCoords(bottomRightIsoScreenPos, 0.0f, TileViewMode::Isometric); |
| 271 | |
| 272 | Vec2<float> topLeftRectPos = this->tileToOffsetScreenCoords(topLeftIsoTilePos); |
| 273 | Vec2<float> topRightRectPos = this->tileToOffsetScreenCoords(topRightIsoTilePos); |
| 274 | Vec2<float> bottomLeftRectPos = this->tileToOffsetScreenCoords(bottomLeftIsoTilePos); |
| 275 | Vec2<float> bottomRightRectPos = this->tileToOffsetScreenCoords(bottomRightIsoTilePos); |
| 276 | |
| 277 | r.drawLine(topLeftRectPos, topRightRectPos, this->strategyViewBoxColour, |
| 278 | this->strategyViewBoxThickness); |
| 279 | r.drawLine(topRightRectPos, bottomRightRectPos, this->strategyViewBoxColour, |
| 280 | this->strategyViewBoxThickness); |
| 281 | |
| 282 | r.drawLine(bottomRightRectPos, bottomLeftRectPos, this->strategyViewBoxColour, |
| 283 | this->strategyViewBoxThickness); |
| 284 | r.drawLine(bottomLeftRectPos, topLeftRectPos, this->strategyViewBoxColour, |
| 285 | this->strategyViewBoxThickness); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | void TileView::update() { applyScrolling(); } |
| 290 | }; // namespace OpenApoc |
nothing calls this directly
no test coverage detected