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

Method DrawItem

engine/Poseidon/UI/DisplayUI.cpp:702–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700 GEngine->Draw3D(position, down, 0.4 * rightSB, ClipAll, selBgColor, DisableSun, nullptr, 0, y1c, 1,
701 y2c);
702 break;
703 case 0:
704 GEngine->Draw3D(position + 0.4 * rightSB, down, 0.6 * rightSB, ClipAll, selBgColor, DisableSun, nullptr,
705 0, y1c, 1, y2c);
706 break;
707 }
708 selColor = ModAlpha(GetSelColor(i), alpha);
709 }
710
711 Vector3 curPos = position - 0.002 * normal;
712
713 Texture* texture = GetTexture(i);
714 if (texture)
715 {
716 Vector3 right = (float)texture->AWidth() / (float)texture->AHeight() * down.Size() * _right.Normalized();
717 float rightSize = right.Size();
718 float x2c = 1;
719 if (rightSize > rightSBSize)
720 {
721 x2c = rightSBSize / rightSize;
722 }
723 GEngine->Draw3D(curPos, down, right, ClipAll, color, // PackedColor(Color(1, 1, 1, alpha)),
724 DisableSun, texture, 0, y1c, x2c, y2c);
725 curPos += right;
726 rightSBSize -= rightSize;
727 if (rightSBSize <= 0)
728 {
729 return;
730 }
731 }
732
733 float top = 0.5 * (1.0 - _size);
734 Vector3 pos = curPos + top * down + border;
735 Vector3 up = -_size * down;
736 Vector3 right = 0.75 * up.Size() * _right.Normalized();
737 float invRightSize = 1.0 / right.Size();
738 float x2ct = rightSBSize * invRightSize;
739 float y1ct = 0;
740 float y2ct = 1;
741 if (y1c > top)
742 {
743 y1ct = (y1c - top) / _size;
744 }
745 if (y2c < top + _size)
746 {
747 y2ct = (y2c - top) / _size;
748 }
749
750 RString text = GetText(i);
751 float x2c = 0.4 * x2ct - 2.0 * invRightSize * border.Size();
752 GEngine->DrawText3D(pos, up, right, ClipAll, _font, _mode == -1 ? selColor : color, DisableSun, text, 0, y1ct, x2c,
753 y2ct);
754 pos += 0.4 * rightSB;
755
756 x2c = 0.6 * x2ct - 2.0 * invRightSize * border.Size();
757 PackedColor noCollision = _mode == 0 ? selColor : color;
758 PackedColor collision = PackedColor(Color(1, 0, 0, alpha));
759 for (int j = 0; j < _keys[i].Size(); j++)

Callers

nothing calls this directly

Calls 15

IsEnabledFunction · 0.85
GetTextureFunction · 0.85
ColorClass · 0.85
GetKeyNameFunction · 0.85
Draw3DMethod · 0.80
AWidthMethod · 0.80
AHeightMethod · 0.80
DrawText3DMethod · 0.80
GetText3DWidthMethod · 0.80
ModAlphaFunction · 0.70
GetTextFunction · 0.50
PackedColorClass · 0.50

Tested by

no test coverage detected