MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OutFont

Method OutFont

ogsr_engine/xr_3da/XR_IOConsole.cpp:238–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238void CConsole::OutFont(LPCSTR text, float& pos_y)
239{
240 float str_length = pFont->SizeOf_(text);
241 float scr_width = 1.98f * Device.fWidth_2;
242 if (str_length > scr_width) //1024.0f
243 {
244 int sz = 0;
245 int ln = 0;
246 LPSTR one_line = (LPSTR)_alloca((CONSOLE_BUF_SIZE + 1) * sizeof(char));
247
248 while (text[sz] && (ln + sz < CONSOLE_BUF_SIZE - 5)) // перенос строк
249 {
250 one_line[ln + sz] = text[sz];
251 one_line[ln + sz + 1] = 0;
252
253 float t = pFont->SizeOf_(one_line + ln);
254 if (t > scr_width)
255 {
256 OutFont(text + sz + 1, pos_y);
257 pos_y -= lineDistance;
258 pFont->OutI(-1.0f, pos_y, "%s", one_line + ln);
259 ln = sz + 1;
260 }
261
262 ++sz;
263 }
264 }
265 else
266 {
267 pFont->OutI(-1.0f, pos_y, "%s", text);
268 }
269}
270
271void CConsole::OnScreenResolutionChanged()
272{

Callers

nothing calls this directly

Calls 2

SizeOf_Method · 0.80
OutIMethod · 0.80

Tested by

no test coverage detected