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

Method DrawMount

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

Source from the content-addressed store, hash-verified

1202}
1203
1204void CStaticMap::DrawMount(Vector3Par pos)
1205{
1206 DrawCoord pt = WorldToScreen(pos);
1207 float size = 0.02;
1208
1209 char buffer[256];
1210 ::sprintf(buffer, "%.0f", pos.Y());
1211
1212 float h = size;
1213 float w = GEngine->GetTextWidth(size, _fontNames, buffer);
1214
1215 if (pt.x + w + 0.005 < _x)
1216 {
1217 return;
1218 }
1219 if (pt.y + 0.5 * h < _y)
1220 {
1221 return;
1222 }
1223 if (pt.x > _x + _w)
1224 {
1225 return;
1226 }
1227 if (pt.y - 0.5 * h > _y + _h)
1228 {
1229 return;
1230 }
1231
1232 int x = toIntFloor(pt.x * _wScreen);
1233 int y = toInt(pt.y * _hScreen);
1234 GEngine->DrawLine(Line2DPixel(x, y - 1, x + 1, y - 1), _colorCountlines, _colorCountlines, _clipRect);
1235 GEngine->DrawLine(Line2DPixel(x + 1, y - 1, x + 1, y + 1), _colorCountlines, _colorCountlines, _clipRect);
1236 GEngine->DrawLine(Line2DPixel(x + 1, y + 1, x, y + 1), _colorCountlines, _colorCountlines, _clipRect);
1237 GEngine->DrawLine(Line2DPixel(x, y + 1, x, y - 1), _colorCountlines, _colorCountlines, _clipRect);
1238 GEngine->DrawText(Point2DFloat(pt.x + 0.005, pt.y - 0.5 * h), size, Rect2DFloat(_x, _y, _w, _h), _fontNames,
1239 _colorNames, buffer);
1240}
1241
1242#define HEIGHT_LOG (GLandscape->GetTerrainRangeLog() - GLandscape->GetLandRangeLog())
1243

Callers

nothing calls this directly

Calls 9

sprintfFunction · 0.85
Line2DPixelClass · 0.85
toIntFunction · 0.50
Point2DFloatClass · 0.50
Rect2DFloatClass · 0.50
YMethod · 0.45
GetTextWidthMethod · 0.45
DrawLineMethod · 0.45
DrawTextMethod · 0.45

Tested by

no test coverage detected