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

Method DrawBackgrounds

ogsr_engine/xr_3da/XR_IOConsole.cpp:429–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429void CConsole::DrawBackgrounds(bool bGame)
430{
431 float ky = (bGame) ? 0.5f : 1.0f;
432
433 Frect r;
434 r.set(0.0f, 0.0f, float(Device.dwWidth), ky * float(Device.dwHeight));
435
436 UIRender->SetShader(**m_hShader_back);
437 // 6 = back, 12 = tips, (VIEW_TIPS_COUNT+1)*6 = highlight_words, 12 = scroll
438 UIRender->StartPrimitive(6 + 12 + (VIEW_TIPS_COUNT + 1) * 6 + 12, IUIRender::ptTriList, IUIRender::pttTL);
439
440 DrawRect(r, back_color);
441
442 if (m_tips.empty() || m_disable_tips)
443 {
444 UIRender->FlushPrimitive();
445 return;
446 }
447
448 LPCSTR max_str = "xxxxx";
449 vecTipsEx::iterator itb = m_tips.begin();
450 vecTipsEx::iterator ite = m_tips.end();
451 for (; itb != ite; ++itb)
452 {
453 if (pFont->SizeOf_((*itb).text.c_str()) > pFont->SizeOf_(max_str))
454 {
455 max_str = (*itb).text.c_str();
456 }
457 }
458
459 float w1 = pFont->SizeOf_("_");
460 float ioc_w = pFont->SizeOf_(ioc_prompt) - w1;
461 float cur_cmd_w = pFont->SizeOf_(m_cur_cmd.c_str());
462 cur_cmd_w += (cur_cmd_w > 0.01f) ? w1 : 0.0f;
463
464 float list_w = pFont->SizeOf_(max_str) + 2.0f * w1;
465
466 float font_h = pFont->CurrentHeight_();
467 float tips_h = std::min(m_tips.size(), (size_t)VIEW_TIPS_COUNT) * font_h;
468 //tips_h += (!m_tips.empty()) ? 5.0f : 0.0f; // убрал, хз зачем там 5 пикслелей снизу добовлялось. не красиво )
469
470 Frect pr, sr;
471 pr.x1 = ioc_w + cur_cmd_w;
472 pr.x2 = pr.x1 + list_w;
473
474 pr.y1 = UI_BASE_HEIGHT * 0.5f;
475 pr.y1 *= float(Device.dwHeight) / UI_BASE_HEIGHT;
476
477 pr.y2 = pr.y1 + tips_h;
478
479 DrawRect(pr, tips_back_color);
480
481 float select_y = 0.0f;
482 float select_h = 0.0f;
483
484 if (m_select_tip >= 0 && m_select_tip < (int)m_tips.size())
485 {
486 int sel_pos = m_select_tip - m_start_tip;

Callers

nothing calls this directly

Calls 14

StartPrimitiveMethod · 0.80
FlushPrimitiveMethod · 0.80
SizeOf_Method · 0.80
CurrentHeight_Method · 0.80
minFunction · 0.50
setMethod · 0.45
SetShaderMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected