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

Method Draw

engine/Poseidon/Graphics/Cursor/ViewerCursorOverlay.cpp:11–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9{
10
11void ViewerCursorOverlay::Draw(Engine* engine)
12{
13 if (!engine || !engine->TextBank())
14 return;
15
16 MipInfo white = engine->TextBank()->UseMipmap(nullptr, 0, 0);
17
18 auto& input = InputSubsystem::Instance();
19 float ndcX = input.GetCursorX();
20 float ndcY = input.GetCursorY();
21 int cx = (int)((ndcX * 0.5f + 0.5f) * engine->Width2D());
22 int cy = (int)((ndcY * 0.5f + 0.5f) * engine->Height2D());
23
24 // Compact rectangle cursor — 9×9 white square with 1-px black halo
25 // and a single-pixel hot point. Reads cleanly against any
26 // background (the halo gives contrast on light terrain, the
27 // hot-point dot gives a precise focus). Square shape was the
28 // explicit ask — rings looked busy, the rect is closer to a
29 // standard pointer.
30 const PackedColor fg(Color(1.0f, 1.0f, 1.0f, 1.0f));
31 const PackedColor halo(Color(0.0f, 0.0f, 0.0f, 0.85f));
32
33 // Halo (11×11) underneath
34 engine->Draw2D(white, halo, Rect2DPixel(cx - 5, cy - 5, 11, 11));
35 // White rect on top with a 1-px halo gap on each side (so the
36 // halo reads as an outline).
37 engine->Draw2D(white, fg, Rect2DPixel(cx - 4, cy - 4, 9, 9));
38 // Central hot-point pixel — black against the white square so
39 // the user can see exactly where the click would land.
40 engine->Draw2D(white, halo, Rect2DPixel(cx, cy, 1, 1));
41}
42
43void ViewerCursorOverlay::ToggleLock(Engine* engine)
44{

Callers

nothing calls this directly

Calls 9

ColorClass · 0.85
Rect2DPixelClass · 0.50
TextBankMethod · 0.45
UseMipmapMethod · 0.45
GetCursorXMethod · 0.45
GetCursorYMethod · 0.45
Width2DMethod · 0.45
Height2DMethod · 0.45
Draw2DMethod · 0.45

Tested by

no test coverage detected