MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DrawMenu

Method DrawMenu

engine/Poseidon/UI/InGame/InGameUIDraw.cpp:754–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

752}
753
754void InGameUI::DrawMenu()
755{
756 if (_tmPos >= 1.0)
757 {
758 return;
759 }
760
761 Texture* textureDef = GLOB_SCENE->Preloaded(TextureWhite);
762 const int w = GLOB_ENGINE->Width2D();
763 const int h = GLOB_ENGINE->Height2D();
764 const float border = 0.005;
765 float size = 0.02;
766
767 float tmLeft = tmX + (1 - tmX) * _tmPos;
768 Texture* corner = GLOB_SCENE->Preloaded(Corner);
769 DrawFrame(corner, bgColor, Rect2DPixel(tmLeft * w, tmY * h, tmW * w, tmH * h));
770
771 MipInfo mip = GLOB_ENGINE->TextBank()->UseMipmap(textureDef, 0, 0);
772
773 float width;
774 width = GLOB_ENGINE->GetTextWidth(size, _font24, _menuCurrent->_text) + 2 * border;
775
776 float height = size + 2 * border;
777 float left = tmLeft + tmW - border - width;
778 float top = tmY + tmH;
779 GLOB_ENGINE->Draw2D(mip, capBgColor, Rect2DPixel(left * w, top * h, width * w, height * h));
780
781 GLOB_ENGINE->DrawText(Point2DFloat(left + border, top + border), size, _font24, capFtColor, _menuCurrent->_text);
782
783 top = tmY + border;
784 height = size;
785 PackedColor color;
786 for (int i = 0; i < _menuCurrent->_items.Size(); i++)
787 {
788 MenuItem* item = _menuCurrent->_items[i];
789 if (!item->_visible)
790 {
791 continue;
792 }
793
794 if (item->_cmd == CMD_SEPARATOR)
795 {
796 top += border;
797 GEngine->DrawLine(Line2DPixel((tmLeft + border) * w, top * h, (tmLeft + tmW - border) * w, top * h),
798 menuDisabledColor, menuDisabledColor);
799 top += border;
800 continue;
801 }
802
803 if (item->_check)
804 {
805 color = menuCheckedColor;
806 }
807 else if (item->_enable)
808 {
809 color = menuEnabledColor;
810 }
811 else

Callers

nothing calls this directly

Calls 15

DrawFrameFunction · 0.85
Line2DPixelClass · 0.85
floatMaxFunction · 0.85
Rect2DPixelClass · 0.50
Point2DFloatClass · 0.50
PreloadedMethod · 0.45
Width2DMethod · 0.45
Height2DMethod · 0.45
UseMipmapMethod · 0.45
TextBankMethod · 0.45
GetTextWidthMethod · 0.45
Draw2DMethod · 0.45

Tested by

no test coverage detected