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

Function DrawFrame

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

Source from the content-addressed store, hash-verified

43
44using namespace Poseidon;
45void DrawFrame(Texture* corner, PackedColor color, const Rect2DPixel& frame)
46{
47 const int screenW = GLOB_ENGINE->Width2D();
48 const int screenH = GLOB_ENGINE->Height2D();
49
50 MipInfo mip = GLOB_ENGINE->TextBank()->UseMipmap(corner, 0, 0);
51 float invCornerH = 1, invCornerW = 1;
52 if (corner)
53 {
54 invCornerH = 1200.0 * (1.0 / (screenH * corner->AHeight()));
55 invCornerW = 1600.0 * (1.0 / (screenW * corner->AWidth()));
56 }
57 Draw2DPars pars;
58 Rect2DPixel rect;
59 rect.w = 0.5 * frame.w;
60 rect.h = 0.5 * frame.h;
61 pars.mip = mip;
62 pars.SetColor(color);
63 pars.spec = NoZBuf | IsAlpha | ClampU | ClampV | IsAlphaFog;
64 float coefX = 0.5 * frame.w * invCornerW;
65 float coefY = 0.5 * frame.h * invCornerH;
66
67 rect.x = frame.x;
68 rect.y = frame.y;
69 pars.SetU(0, coefX);
70 pars.SetV(0, coefY);
71 GLOB_ENGINE->Draw2D(pars, rect);
72
73 rect.x = frame.x + rect.w;
74 rect.y = frame.y;
75 pars.SetU(coefX, 0);
76 pars.SetV(0, coefY);
77 GLOB_ENGINE->Draw2D(pars, rect);
78
79 rect.x = frame.x;
80 rect.y = frame.y + rect.h;
81 pars.SetU(0, coefX);
82 pars.SetV(coefY, 0);
83 GLOB_ENGINE->Draw2D(pars, rect);
84
85 rect.x = frame.x + rect.w;
86 rect.y = frame.y + rect.h;
87 pars.SetU(coefX, 0);
88 pars.SetV(coefY, 0);
89 GLOB_ENGINE->Draw2D(pars, rect);
90
91 // GLOB_ENGINE->TextBank()->ReleaseMipmap();
92}
93
94struct DrawActionInfo
95{

Callers 7

OnDrawMethod · 0.85
DrawMenuMethod · 0.85
DrawTacticalDisplayMethod · 0.85
DrawCompassMethod · 0.85
DrawGroupDirMethod · 0.85
DrawGroupInfoMethod · 0.85
OnDrawMethod · 0.85

Calls 10

AHeightMethod · 0.80
AWidthMethod · 0.80
Width2DMethod · 0.45
Height2DMethod · 0.45
UseMipmapMethod · 0.45
TextBankMethod · 0.45
SetColorMethod · 0.45
SetUMethod · 0.45
SetVMethod · 0.45
Draw2DMethod · 0.45

Tested by

no test coverage detected