MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / configA11y

Function configA11y

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp:3665–3786  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////// Accessibility ///////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

3663 // Accessibility
3664 ////////////////////////////////////////////////////////////////
3665 void configA11y(s32 tabWidth, u32 height)
3666 {
3667 // WINDOW --------------------------------------------
3668 TFE_Settings_A11y* a11ySettings = TFE_Settings::getA11ySettings();
3669 f32 labelW = 140 * s_uiScale;
3670 f32 valueW = 260 * s_uiScale - 10;
3671
3672 // Draw the example caption if captions are enabled, and resize the settings window accordingly.
3673 if (a11ySettings->captionSystemEnabled())
3674 {
3675 Vec2f captionWindowSize = TFE_A11Y::drawExampleCaptions();
3676
3677 // Resize the settings window so it isn't covered by the example caption
3678 ImVec2 windowSize;
3679 windowSize.x = (f32)tabWidth;
3680 windowSize.y = (f32)height - captionWindowSize.z - TFE_A11Y::DEFAULT_LINE_HEIGHT * 2;
3681 ImGui::SetWindowSize(windowSize);
3682 }
3683 else // Captions not enabled
3684 {
3685 ImGui::SetWindowSize(ImVec2((f32)tabWidth, (f32)height));
3686 }
3687
3688 // CAPTIONS -------------------------------------------
3689 ImGui::PushFont(s_dialogFont);
3690 ImGui::LabelText("##ConfigLabel", "Captions");
3691 ImGui::PopFont();
3692
3693 // Check status, and init the caption system if necessary.
3694 if (TFE_A11Y::getCaptionSystemStatus() == TFE_A11Y::CC_NOT_LOADED)
3695 {
3696 TFE_A11Y::refreshFiles();
3697 }
3698 if (TFE_A11Y::getCaptionSystemStatus() == TFE_A11Y::CC_ERROR)
3699 {
3700 ImGui::LabelText("##ConfigLabel", "Error: Caption file could not be loaded!");
3701 }
3702
3703 // Caption file dropdown.
3704 ImGui::LabelText("##ConfigLabel", "Subtitle/caption file:");
3705 TFE_A11Y::FilePath currentCaptionFile = TFE_A11Y::getCurrentCaptionFile();
3706 string currentCaptionFilePath = DrawFileListCombo("##ccfile", currentCaptionFile.name, currentCaptionFile.path, TFE_A11Y::getCaptionFiles());
3707 // If user changed the selected caption file, reload captions.
3708 if (currentCaptionFilePath != currentCaptionFile.path)
3709 {
3710 TFE_A11Y::clearActiveCaptions();
3711 TFE_A11Y::loadCaptions(currentCaptionFilePath);
3712 }
3713
3714 // Font file dropdown.
3715 ImGui::LabelText("##ConfigLabel", "Font:");
3716 TFE_A11Y::FilePath currentFont = TFE_A11Y::getCurrentFontFile();
3717 string currentFontPath = DrawFileListCombo("##fontfile", currentFont.name, currentFont.path, TFE_A11Y::getFontFiles());
3718 // If user changed the selected font file, queue the font to load after we finish rendering ImGui
3719 // (we can't add new fonts to the ImGui font atlas while ImGui is active).
3720 if (currentFontPath != currentFont.path)
3721 {
3722 TFE_A11Y::setPendingFont(currentFontPath);

Callers 1

drawFunction · 0.85

Calls 15

getA11ySettingsFunction · 0.85
drawExampleCaptionsFunction · 0.85
ImVec2Function · 0.85
getCaptionSystemStatusFunction · 0.85
refreshFilesFunction · 0.85
getCurrentCaptionFileFunction · 0.85
DrawFileListComboFunction · 0.85
getCaptionFilesFunction · 0.85
clearActiveCaptionsFunction · 0.85
loadCaptionsFunction · 0.85
getCurrentFontFileFunction · 0.85
getFontFilesFunction · 0.85

Tested by

no test coverage detected