MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnPaint

Method OnPaint

editor/D3Splash.cpp:113–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void CD3Splash::OnPaint() {
114 CPaintDC dc(this); // device context for painting
115 CDC sdc; // source dc
116 CBitmap *bmp;
117 CFont *fnt;
118 CSize textdim;
119 BITMAP bm;
120 RECT uprect;
121 int x, y;
122
123 GetClientRect(&uprect);
124
125 m_SplashBmp.GetObject(sizeof(bm), &bm);
126
127 sdc.CreateCompatibleDC(NULL);
128 bmp = sdc.SelectObject(&m_SplashBmp);
129 dc.StretchBlt(uprect.left + 1, uprect.top + 1, uprect.right - uprect.left - 2, uprect.bottom - uprect.top - 2, &sdc,
130 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
131 sdc.SelectObject(bmp);
132
133 fnt = dc.SelectObject(GetFont());
134 dc.SetBkMode(TRANSPARENT);
135 dc.SetTextColor(RGB(255, 255, 255));
136
137 textdim = dc.GetTextExtent(&m_TextLines[0][0], lstrlen(m_TextLines[0]));
138
139 y = uprect.bottom - (4 * (textdim.cy + 2));
140
141 for (int r = 0; r < 3; r++) {
142 if (lstrlen(m_TextLines[r])) {
143 textdim = dc.GetTextExtent(&m_TextLines[r][0], lstrlen(m_TextLines[r]));
144 x = ((uprect.right - uprect.left) - textdim.cx) / 2;
145 dc.TextOut(x, y, &m_TextLines[r][0], lstrlen(m_TextLines[r]));
146 y += textdim.cy + 2;
147 }
148 }
149 dc.SelectObject(fnt);
150}
151
152void CD3Splash::OnDestroy() {
153 CDialog::OnDestroy();

Callers

nothing calls this directly

Calls 1

SetTextColorMethod · 0.80

Tested by

no test coverage detected