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

Method onRender

game/ui/general/transactioncontrol.cpp:728–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

726}
727
728void TransactionControl::onRender()
729{
730 Control::onRender();
731
732 static Vec2<int> bgLeftPos = {0, 2};
733 static Vec2<int> bgRightPos = {172, 2};
734 static Vec2<int> ammoPos = {4, 2};
735 static Vec2<int> iconLeftPos = {58, 24};
736 static Vec2<int> iconRightPos = {270, 24};
737 static Vec2<int> iconSize = {22, 20};
738
739 // Draw BG
740 fw().renderer->draw(bgLeft, bgLeftPos);
741 fw().renderer->draw(bgRight, bgRightPos);
742 // Draw Ammo Arrow
743 if (isAmmo)
744 {
745 fw().renderer->draw(purchaseArrow, ammoPos);
746 }
747 // Draw Icons
748 if (!deltaLeft->isVisible())
749 {
750 sp<Image> icon;
751 if (isBio)
752 {
753 icon = tradeState.getLeftIndex() == ECONOMY_IDX ? alienContainedKill
754 : alienContainedDetain;
755 }
756 else
757 {
758 icon = tradeState.getLeftIndex() == ECONOMY_IDX ? purchaseBoxIcon : purchaseXComIcon;
759 }
760 auto iconPos = iconLeftPos + (iconSize - (Vec2<int>)icon->size) / 2;
761 fw().renderer->draw(icon, iconPos);
762 }
763 if (!deltaRight->isVisible())
764 {
765 sp<Image> icon;
766 if (isBio)
767 {
768 icon = tradeState.getRightIndex() == ECONOMY_IDX ? alienContainedKill
769 : alienContainedDetain;
770 }
771 else
772 {
773 icon = tradeState.getRightIndex() == ECONOMY_IDX ? purchaseBoxIcon : purchaseXComIcon;
774 }
775 auto iconPos = iconRightPos + (iconSize - (Vec2<int>)icon->size) / 2;
776 fw().renderer->draw(icon, iconPos);
777 }
778}
779
780void TransactionControl::postRender()
781{

Callers

nothing calls this directly

Calls 4

drawMethod · 0.45
isVisibleMethod · 0.45
getLeftIndexMethod · 0.45
getRightIndexMethod · 0.45

Tested by

no test coverage detected