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

Method DrawName

engine/Poseidon/UI/Map/UIMap.cpp:1167–1202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165}
1166
1167void CStaticMap::DrawName(const ParamEntry& cls)
1168{
1169 Vector3 pos;
1170 pos.Init();
1171 pos[0] = (cls >> "position")[0];
1172 pos[2] = (cls >> "position")[1];
1173 pos[1] = 0;
1174 DrawCoord pt = WorldToScreen(pos);
1175
1176 float size = _sizeNames * (_invScaleX * 0.05);
1177 saturate(size, 0.5 * _fontNames->Height(), 2.0 * _fontNames->Height());
1178
1179 RString text = cls >> "name";
1180 float h = size;
1181 float w = GEngine->GetTextWidth(size, _fontNames, text);
1182
1183 if (pt.x + w < _x)
1184 {
1185 return;
1186 }
1187 if (pt.y + 0.5 * h < _y)
1188 {
1189 return;
1190 }
1191 if (pt.x > _x + _w)
1192 {
1193 return;
1194 }
1195 if (pt.y - 0.5 * h > _y + _h)
1196 {
1197 return;
1198 }
1199
1200 GEngine->DrawText(Point2DFloat(pt.x, pt.y - 0.5 * h), size, Rect2DFloat(_x, _y, _w, _h), _fontNames, _colorNames,
1201 text);
1202}
1203
1204void CStaticMap::DrawMount(Vector3Par pos)
1205{

Callers

nothing calls this directly

Calls 7

saturateFunction · 0.85
Point2DFloatClass · 0.50
Rect2DFloatClass · 0.50
InitMethod · 0.45
HeightMethod · 0.45
GetTextWidthMethod · 0.45
DrawTextMethod · 0.45

Tested by

no test coverage detected