MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / renderBase

Method renderBase

game/ui/base/basescreen.cpp:507–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505bool BaseScreen::isTransition() { return false; }
506
507void BaseScreen::renderBase()
508{
509 const Vec2<int> BASE_POS = baseView->getLocationOnScreen();
510
511 BaseGraphics::renderBase(BASE_POS, *state->current_base);
512
513 // Draw selection
514 if (selection != NO_SELECTION)
515 {
516 Vec2<int> pos = selection;
517 Vec2<int> size = {BaseGraphics::TILE_SIZE, BaseGraphics::TILE_SIZE};
518 if (drag && dragFacility)
519 {
520 size *= dragFacility->size;
521 }
522 else if (selFacility != nullptr)
523 {
524 pos = selFacility->pos;
525 size *= selFacility->type->size;
526 }
527 pos = BASE_POS + pos * BaseGraphics::TILE_SIZE;
528 fw().renderer->drawRect(pos, size, Colour{255, 255, 255});
529 }
530
531 // Draw dragged facility
532 if (drag && dragFacility)
533 {
534 sp<Image> facility = dragFacility->sprite;
535 Vec2<int> pos;
536 if (selection == NO_SELECTION)
537 {
538 pos = mousePos - Vec2<int>{BaseGraphics::TILE_SIZE, BaseGraphics::TILE_SIZE} / 2 *
539 dragFacility->size;
540 }
541 else
542 {
543 pos = BASE_POS + selection * BaseGraphics::TILE_SIZE;
544 }
545 fw().renderer->draw(facility, pos);
546 }
547}
548
549}; // namespace OpenApoc

Callers

nothing calls this directly

Calls 3

getLocationOnScreenMethod · 0.80
drawRectMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected